Provides for type member fields that are relative for the thread. Whenever the static field is accessed on a particular thread it will be unique or relative for that thread only. The static is not shared between threads. If the static field is access on another thread the field will contain a different value, since the field is unique per thread. Null initialization of thread local statics. The member field is marked with a custom attribute ThreadStaticAttribute.
Object
Attribute
ThreadStaticAttribute
[Visual Basic] Public Class ThreadStaticAttribute Inherits Attribute [C#] public class ThreadStaticAttribute : Attribute [C++] public __gc class ThreadStaticAttribute : public Attribute [JScript] public class ThreadStaticAttribute extends Attribute
[To be supplied.]
Namespace: System
Assembly: mscorlib.dll
[C#]
class Foo { int a; static int b; [ThreadStaticAttribute()] static int c; int d=5; static int e=6; [ThreadStaticAttribute()] 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); } }
Field a is an unintialized instance member.
Field b is an uninitalized static member.
Field c is an uninitialized relative static member.
Field d is an initialized instance member.
Field e is an initialized static member.
Field f is an initialized relative static member.