What do mean by static modifier in C# programming language?

 Posted by Goud.Kv on 9/1/2014 | Category: C# Interview questions | Views: 1893 | Points: 40
Answer:

static is a keyword which can be used in many cases such as for classes, methods, operators, constructors etc. static denotes the singular type and is used to declare a member or type.
static methods are very faster when compared with instance methods as they doesn't comprises any instances.
By using static, flexibility becomes less but performance will be more.

static class MyClass          // This is a static class

{
static int x; // This is a static variable
public static void Test() // This is a static method
{
.........;
........;
}
}


Asked In: Spotted While Learning | Alert Moderator 

Comments or Responses

Login to post response