Here we will explain how to create static class in C# or what is static class in c# or what are benefits of by using static class in c# with example.


A class can be declared by using static keyword.  The C# static class is like the normal class .It is not possible to create instances of a static class using the new keyword. It can have only static members. The advantage of using a static class is that the compiler will provides you guarantee that instances of static class cannot be created.

  •  The main features of a static class are:

ü  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 a static method.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Static_Class
    public static class Math
    {                public static float CalculateAmount(int rate, int item, float amount)
            return rate * item * amount;
    class Program
        public static void Main(string[] args)
            Console.WriteLine("Total Amount: " + Math.CalculateAmount(120,20,100));





Total Amount : 240000

I hope this will help to you.

Leave a comment

Make sure you enter the (*) required information where indicated. HTML code is not allowed.

You may also like