8.2. Static members

This section covers static members in general. More information on static methods can be found in section 7.12.

The use of static in C# is almost identical to the use of the same keyword in Java. A class member declared without the static modifier is considered non-static or belonging to an instance. A static member of a class does not belong to an instance of this class, but rather to the whole class itself. A non-static member of a class is also known as an instance member.

A static field identifies only one storage location so that no matter how many instances of this class are created, there is only one copy of this static field for a particular application domain. [3] The following is an example showing the use of static ...

Get From Java to C#: A Developer's Guide now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.