Why doesn't C# support local static variables like C does?
c#, static
Solution
You can simulate it using a delegate... Here is my sample code:
public Func<int> Increment()
{
int num = 0;
return new Func<int>(() =>
{
return num++;
});
}
You can call it like this:
Func<int> inc = Increment();
inc();
Problem
Why doesn't C# have local static variables like C? I miss that!!