This documentation is archived and is not being maintained.

ContextStaticAttribute Class

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

For a list of all members of this type, see ContextStaticAttribute Members.


[Visual Basic]
Public Class ContextStaticAttribute
   Inherits Attribute
public class ContextStaticAttribute : Attribute
public __gc class ContextStaticAttribute : public Attribute
class ContextStaticAttribute extends Attribute

Thread Safety

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


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:


static int f=7;

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


Namespace: System

Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family

Assembly: Mscorlib (in Mscorlib.dll)

See Also

ContextStaticAttribute Members | System Namespace | Attribute | Context | Extending Metadata Using Attributes