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

django - How can I change user group without delete record -

java - Need to add SOAP security token -

java - EclipseLink JPA Object is not a known entity type -