Tutorial by Examples

The static keyword means 2 things: This value does not change from object to object but rather changes on a class as a whole Static properties and methods don't require an instance. public class Foo { public Foo{ Counter++; NonStaticCounter++; } public st...
The "static" keyword when referring to a class has three effects: You cannot create an instance of a static class (this even removes the default constructor) All properties and methods in the class must be static as well. A static class is a sealed class, meaning it cannot be inherite...
A static class is lazily initialized on member access and lives for the duration of the application domain. void Main() { Console.WriteLine("Static classes are lazily initialized"); Console.WriteLine("The static constructor is only invoked when the class is first accessed&...

Page 1 of 1