A Non-static class can contain static methods, fields, properties, or events. The static member is callable in a class even when no instance of the class have been created. The static member is all accessed by the class name and not the instance name. Only one copy of a static member exists, regardless of what many instances of the class is created. Static methods and properties cannot access non-static fields and events in their containing type, and they cannot access An instance variable of any object unless it was explicitly passed in a method parameter.
It is more typical to declare a non-static class with some static members, than to declare an entire class as static. Common uses of static fields is to keep a count of the number of objects that has been instantiated, or to store a V Alue that must is shared among all instances.
Static methods can overloaded but not overridden, because they belong to the class, and not to any instance of the Clas S.
Although a field cannot be declared asstatic const, a const field is essentially static in its behavior. It belongs to the type, not to instances of the type. Therefore, const fields can being accessed by using the sameClassname.membername notation that's used for static fi ELDs. No object instance is required.
C # does not the support static local variables (variables is declared in method scope).
Static members was initialized before the static member is accessed for the first time and before the static constructor, If there is a, is called.
If your class contains static fields, provide a static constructor then initializes them when the class is loaded.
A call to a static method generates a call instruction in Microsoft intermediate language (MSIL), whereas a call to an INS Tance method generates acallvirt instruction, which also checks for a null object references. However, the most of the time the performance difference between the and the "not" significant.
C #-Static members