Static and static class members are used to create data and functions that can be accessed without the need to create instances of classes.
Static class members can be used to separate data and behavior independent of any object identifier: No matter what changes occur to the object, the data and functions will not change. When the class does not depend on the data or behavior of object identifiers, you can use static classes.
Static class:
Static classes are declared using static statements and only contain static members. You cannot use the new keyword to create static class instances.
When a static class loads a program or namespace containing the class, it is automatically loaded by the. NET Framework Common Language Runtime Library (CLR.
Static classes are sealed and therefore cannot be inherited. A static class cannot contain constructor, but can still declare a static constructor to assign an initial value or set a static state.
Static members:
You can call static methods, fields, attributes, or events in the class even if no instance of the class is created. If any instance of this class is created, the instance cannot be used to access static members.
Static members are usually used to represent data or computing that does not change with the object state.
Static members are initialized before the first access and before any static Constructor (if called. To access a static class member, use the class name instead of the variable name to specify the position of the Member.