Declares the names of properties and the procedures used to change and return values.
[ modifier ] Property declarator [ , declarator ]… [ Does trait_name . old_name ]
[ modifier ] Property declarator [ Begin parameter_list ] [ Get [ statements ] ] [ Set parameter [ statements] ] End [ Property ]
@Abstract– The property contains no implementation and must be overridden in a concrete child class. Only applicable in an abstract class or trait.
@Backed– The property is backed. The one-line construct is always backed.
@Deprecated– The property is deprecated. See @Deprecated for more information.
@Open– The property can be overridden in a child class. Only applicable in an open class.
@Override– The property is a re-implementation of a property inherited from a parent class.
@ReadOnly– The property is read-only. It must return the value with
Get. It cannot change the value with
@Shared– The property is owned by the enclosing class and not an instance of that class.
@WriteOnly– The property is write-only. It must change the value with
Set. It cannot return the value with
- You can put
@WriteOnly. You can put
@Deprecatedtogether with all other modifiers.
- Mandatory one or more declarations that have a similar syntax to the statement
Dim. The one-line construct lets you write several declarators with a comma between each.
name [ ( [ dimensions ] ) ] [ As type | In unit ] [ = initializer ]
- Mandatory name.
- Optional one or more integer expressions with a comma between each. Not permitted with unbacked properties.
- Optional data type
- Optional unit of measure
- Optional expression with a data type compatible with
- Optional in the block construct. Lets you specify that the property is an array.
- Mandatory after
Begin, a list of integer parameters, with a comma between each, which hold the array indices supplied by the caller.
- Identifies the start of a block of code that returns the value of the property.
- Identifies the start of a block of code that changes the value of the property.
- Mandatory after
Set. It must be the same data type as the property. If you do not specify a data type, then the compiler uses the type of the property.
- Optional executable statements
- Completes the block construct.
You can also use
- You can change this part of the syntax. See @Option Directive for more information.
A property has many of the same qualities as a method. A property has public visibility. You can declare a property in libraries, classes, and traits.
A property can have one of two constructs: a one-line construct or a block construct.
The one-line construct is always backed. Thus it automatically allocates memory with each instance of its owner.
The block construct is usually not backed.
Thus it does not automatically allocate memory with each instance of its owner.
If necessary, then use the modifier
Class Person Property Name As String End Class Person #person #person.Name = "John Doe" #Debug.PrintLine #person.Name
One-line array property
Class Person Const MaxAddresses = 2 Property Address(MaxAddresses) As String End Class
Block property, backed
Class Person @Backed Property Name As String Get ' do something Set value ' do something End Property End Class ' do something
Block property, not backed
Class Person Property Name As String Get ' do something Set value ' do something End Property End Class ' do something