When a field-declaration includes a static
modifier, the fields introduced by the declaration are static fields. When no static
modifier is present, the fields introduced by the declaration are instance fields. Static fields and instance fields are two of the several kinds of variables (§5) supported by C#, and are at times referred to as static variables and instance variables.
A static field identifies exactly one storage location. No matter how many instances of a class are created, there is only ever one copy of a static field. A static field comes into existence when the type in which it is declared is loaded, and ceases to exist when the type in which it is declared is unloaded.
Every instance of a class contains a separate copy of all instance fields of the class. An instance field comes into existence when a new instance of its class is created, and ceases to exist when there are no references to that instance and the destructor of the instance has executed.
When a field is referenced in a member-access (§7.5.4) of the form E.M
, if M
is a static field, E
must denote a type, and if M
is an instance field, E must denote an instance.
The differences between static and instance members are further discussed in §10.2.5.