System.Runtime.CompilerServices.CustomConstantAttribute Class

Defines a constant value that a compiler can persist for a field or method parameter.

See Also: CustomConstantAttribute Members

Syntax

[System.AttributeUsage(System.AttributeTargets.Field | System.AttributeTargets.Parameter | System.AttributeTargets.All, Inherited=false)]
[System.Runtime.InteropServices.ComVisible(true)]
public abstract class CustomConstantAttribute : Attribute

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 System.Runtime.CompilerServices.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 System.Runtime.CompilerServices.CustomConstantAttribute enables you to find all occurrences of custom constant attributes easily.

The classes in System.Runtime.CompilerServices are for compiler writers' use only.

Requirements

Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
Assembly Versions: 1.0.5000.0, 2.0.0.0, 4.0.0.0