Note | This command is only available in the FOXPRO dialect |
Declare fields and or properties with optional initial values
[Attributes] [FIELD] [modifiers] <IdName>, <IdName> ...] [AS <idType>]
[Attributes] [[.]Object.] <IdName> = <Expression> ...] [AS <idType>]
Both syntaxes to declare and/or initialize properties are supported.
We have added an optional AS DataType clause.
We have also added an optional FIELD clause that allows you to declare fields (opposed to properties)
FIELD | When you include the FIELD keyword then the names will be the names of fields in the class. Otherwise the compiler will create properties. |
Attributes | An optional list of one or more attributes that describe meta information for am entity, such as for example the [TestMethod] attribute on a method/function containing tests in a MsTest class library. Please note that Attributes must be on the same line or suffixed with a semi colon when they are written on the line above that keyword. |
Modifiers | An optional list of modifiers that specify the visibility or scope of the entity, such as PUBLIC, PROTECTED, HIDDEN, INTERNAL, SEALED, ABSTRACT or STATIC. |
<IdName> | A valid identifier name for the fields or properties to declare. |
AS <idType> | Specifies the data type. If omitted, then depending on the compiler options the type will be either USUAL or determined by the compiler. |
Expression | The initial value to assign to the field/property |
The way in which properties are implemented depends on the value of the /fox1 compiler switch. When this switch is enabled, then all properties will read/write from a property collection that is declared in the Custom Object. When this switch is NOT enabled then 'normal' auto properties will be declared with a backing field in this class.