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 177 views
1 answer 194 views
1 answer 197 views
1 answer 192 views
1 answer 171 views
1 answer 160 views
160 views asked Dec 31, 2016 by avibootz
...