Posted by : Sudhir Chekuri Tuesday, 5 January 2016

C#.NET Static class should contain only static methods.

Static methods cannot be called using reference.
We cannot create object for Static class

Example program for C#.NET Static class
Program

using System;
namespace StaticClass
{
    class Program
    {
        static void Main(string[] args)
        {
            a.add();
        }
    }

    static class a
    {
        static public void add()
        {
            Console.WriteLine("add");
        }
    }

}

Leave a Reply

Subscribe to Posts | Subscribe to Comments

Followers

Total Pageviews

Powered by Blogger.

- Copyright © 2013 DevStudent - Metrominimalist - Powered by Blogger - Designed by Johanes Djogan -