Export (0) Print
Expand All
This topic has not yet been rated - Rate this topic

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.

System.Object
   System.Attribute
      System.ContextStaticAttribute

[Visual Basic]
<AttributeUsage(AttributeTargets.Field)>
<Serializable>
Public Class ContextStaticAttribute
   Inherits Attribute
[C#]
[AttributeUsage(AttributeTargets.Field)]
[Serializable]
public class ContextStaticAttribute : Attribute
[C++]
[AttributeUsage(AttributeTargets::Field)]
[Serializable]
public __gc class ContextStaticAttribute : public Attribute
[JScript]
public
   AttributeUsage(AttributeTargets.Field)
 Serializable
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.

Remarks

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.

Requirements

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

Did you find this helpful?
(1500 characters remaining)
Thank you for your feedback
Show:
© 2014 Microsoft. All rights reserved.