NGWS SDK Documentation  

This is preliminary documentation and subject to change.
To comment on this topic, please send us email at ngwssdk@microsoft.com. Thanks!

ContextStaticAttribute Class

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

Remarks

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.

Requirements

Namespace: System

Assembly: mscorlib.dll

Example [C#]

[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 );
    }
}

See Also

ContextStaticAttribute Members | System Namespace