public static void DoSomething()
{
int a;
string b;
//..do something
}
In the example above, i have declared two variables. Do they become static
No. Only the method is static but not variables.
From MSDN:
C# does not support static local variables (variables that are declared in method scope).
if you want to have static variable in static member, do the declaration outside the static method,
private static int _var = 0;
public static void SampleMethod()
{
_var++;
}