28 June, 2009

What is a static class?

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 can not 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

  • Static classes only contain static members.
  • Static classes can not be instantiated. They cannot contain Instance Constructors
  • Static classes are sealed.

No comments: