What is Static Class

A static class can contain only static members. All objects that you create by using the class share a single copy of these members. The purpose of a static class is purely to act as a holder of utility methods and fields. A static class cannot contain any instance data or methods, and it does not make sense to try to create an object from a static class by using the new operator. In fact, you can’t actually create an instance of an object using a static class by using new even if you want to. (The compiler will report an error if you try.) If you need to perform any initialization, a static class can have a default constructor as long as it is also declared as static. Any other types of constructor are illegal and will be reported as such by the compiler.

Source: Microsoft Visual C# 2013 Step by Step

Leave a Reply

Your email address will not be published. Required fields are marked *