CodeTypeParameter.CustomAttributes Tulajdonság

Definíció

Lekéri a típusparaméter egyéni attribútumait.

public:
 property System::CodeDom::CodeAttributeDeclarationCollection ^ CustomAttributes { System::CodeDom::CodeAttributeDeclarationCollection ^ get(); };
public System.CodeDom.CodeAttributeDeclarationCollection CustomAttributes { get; }
member this.CustomAttributes : System.CodeDom.CodeAttributeDeclarationCollection
Public ReadOnly Property CustomAttributes As CodeAttributeDeclarationCollection

Tulajdonság értéke

A CodeAttributeDeclarationCollection típusparaméter egyéni attribútumait jelzi. Az alapértelmezett érték a null.

Példák

Az alábbi példakód azt mutatja be, hogy a CustomAttributes tulajdonság használata új egyéni attribútum hozzáadásához. Ez a példa egy nagyobb, az CodeTypeParameter osztályhoz tartozó példa része.

kType.CustomAttributes.Add(new CodeAttributeDeclaration(
    "System.ComponentModel.DescriptionAttribute",
        new CodeAttributeArgument(new CodePrimitiveExpression("KeyType"))));
kType.CustomAttributes.Add _
    (New CodeAttributeDeclaration("System.ComponentModel.DescriptionAttribute", _
        New CodeAttributeArgument(New CodePrimitiveExpression("KeyType"))))

Megjegyzések

Ez a tulajdonság metaadat-attribútumok hozzáadására használható a típusparaméter deklarációjára.

Figyelmeztetés

Ez a tulajdonság alapértelmezés szerint be van null jelölve, és a hivatkozás előtt ellenőrizni kell.

A következőre érvényes:

Lásd még