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.

3 comments:

  1. what is the difference between static and private constructor?

    ReplyDelete
  2. clieck this link to know more about static class
    http://www.dotnetpal.com/framework/staticvariable.html

    ReplyDelete
  3. Thanks for this wonderful post. The information in this article is very helpful to me. Thanks a lot for sharing. Keep blogging.
    Best Truth or Dare Questions for Kids

    ReplyDelete

Type more interview question answer here