Is there an equivalent to static of C in C#? -
in c can
void foo() { static int c = 0; printf("%d,", c); c ++; } foo(); foo(); foo(); foo();
it should print 0,1,2,3
is there equivalent in c#?
something like:
class c { private static int c = 0; public void foo() { console.writeline(c); c++; } }
Comments
Post a Comment