Properties
Iodine extends the Java language to allow the definition of true properties that can be accessed like fields using the .
syntax, invoking optional getter or setter code. In addition, Methods named get* and set* imported from external libraries will automatically be made accessible using property syntax as well.
Defining custom properties uses a syntax similar to C#, but with the __get
and __set
keywords.
String Name {
__get {
return fName;
}
__set {
fName = value;
updateUI();
}
}
int Count { __get { return fCount; } }
Bool Test { __get; __set; }
Properties can be accessed using regular .
syntax:
myObject.Name = "Hello";
if (myObject.Test) {
...
}