How to define and use static method in non-static class with C#

1 Answer

0 votes
using System;

namespace ConsoleApplication_C_Sharp
{
    class Program
    {
        static void Method()
        {
            Console.WriteLine("Static method");
        }

        static void Main(string[] args)
        {
            Program.Method();
        }
    }
}


/*
run:
 
Static method

*/

 



answered Dec 31, 2016 by avibootz

Related questions

1 answer 191 views
1 answer 204 views
1 answer 215 views
1 answer 212 views
1 answer 187 views
1 answer 176 views
176 views asked Dec 31, 2016 by avibootz
...