CustomConstantAttribute Class
Defines a constant value that a compiler can persist for a field or method parameter.
For a list of all members of this type, see CustomConstantAttribute Members.
System.Object
System.Attribute
System.Runtime.CompilerServices.CustomConstantAttribute
System.Runtime.CompilerServices.DateTimeConstantAttribute
System.Runtime.CompilerServices.IDispatchConstantAttribute
System.Runtime.CompilerServices.IUnknownConstantAttribute
[Visual Basic] <AttributeUsage(AttributeTargets.Field Or _ AttributeTargets.Parameter)> <Serializable> MustInherit Public Class CustomConstantAttribute Inherits Attribute [C#] [AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter)] [Serializable] public abstract class CustomConstantAttribute : Attribute [C++] [AttributeUsage(AttributeTargets::Field | AttributeTargets::Parameter)] [Serializable] public __gc __abstract class CustomConstantAttribute : public Attribute [JScript] public AttributeUsage(AttributeTargets.Field | AttributeTargets.Parameter) Serializable abstract class CustomConstantAttribute 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
You can apply this attribute to fields or parameters.
This class cannot be instantiated.
Compilers should create specific classes, derived from this class, that define the type of the constant value. For example, see the DateTimeConstantAttribute which allows a compiler to persist an 8-byte DateTime constant for a field or method parameter. If you are using System.Reflection, this pattern of deriving specific classes from CustomConstantAttribute enables you to find all occurances of custom constant attributes easily.
The classes in System.Runtime.CompilerServices are for compiler writers use only.
Requirements
Namespace: System.Runtime.CompilerServices
Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, .NET Compact Framework
Assembly: Mscorlib (in Mscorlib.dll)
See Also
CustomConstantAttribute Members | System.Runtime.CompilerServices Namespace