Show/Hide Toolbars

XSharp

NoteThis command is only available in the Xbase++ dialect

Purpose

Declare fields/ instance variables with optional initial values

Syntax

 [Visibility :]

 [CLASS|STATIC] VAR <idVar,...> [IS <Name>] [IN <SuperClass>]  [AS <idType>]

 [SHARED]

 [READONLY]

 [ASSIGNMENT HIDDEN | PROTECTED | EXPORTED]
 [NOSAVE]

Arguments

VisibilityThis sets the visibility for the variables on the line following the statement. This can be HIDDEN ,PROTECTED, EXPORTED or INTERNAL. The default visibility is HIDDEN.

 

CLASS | STATICDeclares that this is a class level field.

 

<idVar>A valid identifier name for the field to declare.

 

IS .. IN ..This clause is not supported in X#

 

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.

 

SHAREDThis clause is not supported in X#

 

READONLYDeclares this field as Readonly. It must be initialized in the (class) constructor

 

ASSIGNMENT ..This clause is not supported in X#

 

NOSAVEThis sets the [NonSerializable] attribute on the field.

Note

Xbase++ has a complicated set of rules on how to control read/write access to fields. In .Net we simply use the Visibility .