We can declare a static class. We use static class when there is no data or behavior in the class that depends on object identity. A static class can have only static members. We cannot create instances of a static class using the new keyword. .NET Framework common language runtime (CLR) loads Static classes automatically when the program or namespace containing the class is loaded.
Here are some more features of static class
Here are some more features of static class
- Static classes only contain static members.
- Static class cannot create any objects
- Static classes are sealed.
- Static class can have only private constructors
- Static loads automatically when the CLR loads the namespace of the class.
No comments:
Post a Comment