We provide IT Services

Register Now Click On

Read More Tutorials Click On

Post Page Advertisement [Top]


Static method always call same as the class name.Static method does not depend any object.and Static method can be define in static class, but we can not define in non static class.

you can use access modifier before static mathod like as a Public,Private,etc.

Syntax of Static Method:-

Example of Static Method in C#:-

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

namespace What_is_static_method
{
    static class Program
    {
        public static void show()
        {
            Console.WriteLine("Hello Rock programmer");
        }
        class Dev
        {
            static void Main(string[] args)
            {
                Program.show();
                Console.ReadKey();
            }
        }
    }
}

No comments:

Post a Comment

| Designed by Rockprogrammer