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 279 views
1 answer 297 views
1 answer 296 views
1 answer 285 views
1 answer 264 views
1 answer 253 views
253 views asked Dec 31, 2016 by avibootz
...