class Foo { int a; static int b; [ThreadStaticAttribute()] static int c; int d=5; static int e=6; [ThreadStatic()] static int f=7; Foo() { a = 1; b = 2; c = 3; } void Method1() { Console.WriteLine(“{0}”, a); Console.WriteLine(“{0}”, b); Console.WriteLine(“{0}”, c); Console.WriteLine(“{0}”, d); Console.WriteLine(“{0}”, e ); Console.WriteLine(“{0}”, f ); } }
a and d are instance members.
a. Instance member field. Uninitialized.
d. Instance member field. Initialized.
b. class static member field. Uninitialized.
e. class static member field. Initialized.
The static is unique for the AppDomain.
c. thread relative static member field. Uninitialized.
f. thread relative static member field. Initialized.
The static is unique for the thread. The member field is not shared across threads.