Fields

A field is a class member that represents a variable associated with an object or class.

field-declaration:

attributesopt   field-modifiersopt   identifier   :   type   variable-initializeropt   ;

field-modifiers:

field-modifier

field-modifiers   field-modifier

field-modifier:

New

Public

Protected

Friend

Private

Shared

ReadOnly

Volatile

variable-initializer:

=   expression

=   array-initializer

A field value can be obtained in an expression by using a simple name or member access operator.  The value of a non-read-only field is modified using an assignment.

Additional information is contained in the following subsections:

See also:

Classes