20 Sep 2017

what is static class in c sharp with example


static is a keyword, Static class Does not create any type of Object and Static Class .

Static Class always call same as the class name.(static   method)

Static Class does not depend any object.

Static Class created by only Static Contractor.

(static Varibal)

Example of Static Class:-

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace What_is_static_class
{
    static class Programmer
    {
        
        public static void show()
        {
            Console.WriteLine("Hello Rock Programmer");
        }
    }
    class Rock
    {
       public static void Main(string[] args)
        {
            Programmer.show();
            Console.ReadKey();
        }
    }

}

Output of:-





No comments:
Write comments

Contact Form

Name

Email *

Message *

© 2014 Rock Programmer . Designed by Bloggertheme9
Powered by Rock Programmer.