CustomConstantAttribute-Klasse
Definiert einen konstanten Wert, den ein Compiler für einen Feld- oder Methodenparameter beibehalten kann.
Namespace: System.Runtime.CompilerServices
Assembly: mscorlib (in mscorlib.dll)
Syntax
'Declaration
<SerializableAttribute> _
<AttributeUsageAttribute(AttributeTargets.Field Or AttributeTargets.Parameter, Inherited:=False)> _
<ComVisibleAttribute(True)> _
Public MustInherit Class CustomConstantAttribute
Inherits Attribute
'Usage
Dim instance As CustomConstantAttribute
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets.Field|AttributeTargets.Parameter, Inherited=false)]
[ComVisibleAttribute(true)]
public abstract class CustomConstantAttribute : Attribute
[SerializableAttribute]
[AttributeUsageAttribute(AttributeTargets::Field|AttributeTargets::Parameter, Inherited=false)]
[ComVisibleAttribute(true)]
public ref class CustomConstantAttribute abstract : public Attribute
/** @attribute SerializableAttribute() */
/** @attribute AttributeUsageAttribute(AttributeTargets.Field|AttributeTargets.Parameter, Inherited=false) */
/** @attribute ComVisibleAttribute(true) */
public abstract class CustomConstantAttribute extends Attribute
SerializableAttribute
AttributeUsageAttribute(AttributeTargets.Field|AttributeTargets.Parameter, Inherited=false)
ComVisibleAttribute(true)
public abstract class CustomConstantAttribute extends Attribute
Hinweise
Dieses Attribut kann auf Felder oder Parameter angewendet werden.
Diese Klasse kann nicht instanziiert werden.
Compiler müssen bestimmte, von dieser Klasse abgeleitete Klassen erstellen, die den Typ des konstanten Werts definieren. Ein Beispiel finden Sie unter DateTimeConstantAttribute, das einem Compiler das Beibehalten einer DateTime-Konstante von 8 Bytes für ein Feld oder einen Methodenparameter ermöglicht. Wenn Sie System.Reflection verwenden, ermöglicht Ihnen dieses Muster des Ableitens von bestimmten Klassen von CustomConstantAttribute das einfache Suchen aller Vorkommen von benutzerdefinierten konstanten Attributen.
Die Klassen in System.Runtime.CompilerServices dürfen nur von Compilerautoren verwendet werden.
Vererbungshierarchie
System.Object
System.Attribute
System.Runtime.CompilerServices.CustomConstantAttribute
System.Runtime.CompilerServices.DateTimeConstantAttribute
System.Runtime.CompilerServices.IDispatchConstantAttribute
System.Runtime.CompilerServices.IUnknownConstantAttribute
Threadsicherheit
Alle öffentlichen statischen (Shared in Visual Basic) Member dieses Typs sind threadsicher. Bei Instanzmembern ist die Threadsicherheit nicht gewährleistet.
Plattformen
Windows 98, Windows 2000 SP4, Windows CE, Windows Millennium Edition, Windows Mobile für Pocket PC, Windows Mobile für Smartphone, Windows Server 2003, Windows XP Media Center Edition, Windows XP Professional x64 Edition, Windows XP SP2, Windows XP Starter Edition
.NET Framework unterstützt nicht alle Versionen sämtlicher Plattformen. Eine Liste der unterstützten Versionen finden Sie unter Systemanforderungen.
Versionsinformationen
.NET Framework
Unterstützt in: 2.0, 1.1, 1.0
.NET Compact Framework
Unterstützt in: 2.0, 1.0
Siehe auch
Referenz
CustomConstantAttribute-Member
System.Runtime.CompilerServices-Namespace