Export (0) Print
Expand All

ContextStaticAttribute Class

Indicates that the value of a static field is unique for a particular context.

Namespace: System
Assembly: mscorlib (in mscorlib.dll)

[SerializableAttribute] 
[AttributeUsageAttribute(AttributeTargets.Field, Inherited=false)] 
[ComVisibleAttribute(true)] 
public class ContextStaticAttribute : Attribute
/** @attribute SerializableAttribute() */ 
/** @attribute AttributeUsageAttribute(AttributeTargets.Field, Inherited=false) */ 
/** @attribute ComVisibleAttribute(true) */ 
public class ContextStaticAttribute extends Attribute
SerializableAttribute 
AttributeUsageAttribute(AttributeTargets.Field, Inherited=false) 
ComVisibleAttribute(true) 
public class ContextStaticAttribute extends Attribute

A static field marked with ContextStaticAttribute is not shared between contexts. If the indicated static field is accessed on a different context, it will contain a different value. Use this attribute as it is, and do not derive from it.

The following example shows the syntax of this attribute:

[ContextStatic]

static int f=7;

For more information about using attributes, see Extending Metadata Using Attributes.

System.Object
   System.Attribute
    System.ContextStaticAttribute

Any public static (Shared in Visual Basic) members of this type are thread safe. Any instance members are not guaranteed to be thread safe.

Windows 98, Windows 2000 SP4, Windows Millennium Edition, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition

The .NET Framework does not support all versions of every platform. For a list of the supported versions, see System Requirements.

.NET Framework

Supported in: 2.0, 1.1, 1.0

Community Additions

ADD
Show:
© 2014 Microsoft