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

Popular posts from this blog

How do you change vbulletin's home page to the forums instead of the default (CMS or Activity Stream)? -

c++ - Troubles when compiling phash program -