Javatpoint Logo
Javatpoint Logo

C# static class

The C# static class is like the normal class but it cannot be instantiated. It can have only static members. The advantage of static class is that it provides you guarantee that instance of static class cannot be created.

Points to remember for C# static class

  • 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.

C# static class example

Let's see the example of static class that contains static field and static method.

Output:

Value of PI is: 3.14
Cube of 3 is: 27




Please Share

facebook twitter google plus pinterest

Learn Latest Tutorials


B.Tech / MCA