Object
Attribute
ContextStaticAttribute
[Visual Basic] Public Class ContextStaticAttribute Inherits Attribute [C#] public class ContextStaticAttribute : Attribute [C++] public __gc class ContextStaticAttribute : public Attribute [JScript] public class ContextStaticAttribute extends Attribute
Context Relative Statics provide for type member fields that are relative for the context. Whenever the static field is accessed on a particular context it will be unique or relative for that context only. The static is not shared between contexts. If the static field is access on another context the field will contain a different value, since the field is unique per context.
Namespace: System
Assembly: mscorlib.dll
[C#]
class Foo { int a; static int b; [ContextStaticAttribute()] static int c; int d=5; static int e=6; [ContextStatic] 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 ); } }