C# Static class

A static class is non-instantiable i.e. a variable of the class can't be created using the new keyword. so, the static class members have to be accessed using the class name itself.

- A static class is defined using the keyword static it can only have static data members. if this rule is not followed, there is a compile time error.

  • C# static class contains only static members.
  • C# static class cannot be instantiated.
  • C# static class is sealed.
  • C# static class cannot contain instance constructors

Comments

Popular posts from this blog

C# | Association, Aggregation and Composition

Throw vs Throw ex in C#

String[] args in C#