Keyword modifier static in a method header, indicate that the method can be called without referring to an object
Anyone familiar with above statement please explain and support with a example program.
Static in a method header
4 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Satyapriya NayakRank #47 · 31.5K reputationPosted Nov 26, 2011, 7:32 AM EST
When a method declaration includes a static modifier, that method is said to be a static method.Static methods are called without an instance reference
A static method does not operate on a specific instance, and it is a compile-time error to refer to this in a static method.
Ex:-
class Program
{
public static int myVar; //a static field
static void Main()
{
myVar = 10;
Console.WriteLine(myVar);
Console.ReadKey();
}
}
In the above we don't have an object of the class to use that field since the field is static.
Refer
http://www.dotnetperls.com/static-method
Thanks
Posted Nov 26, 2011, 8:17 AM EST
VulpesRank #55 · 29.2K reputationPosted Nov 26, 2011, 8:51 AM EST
Static methods know nothing about particular instances - they apply to the class as a whole and so don't need an instance reference to call them.
Posted Nov 26, 2011, 12:30 PM EST