CodeTypeParameter.CustomAttributes プロパティ

定義

型パラメーターのカスタム属性を取得します。

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

プロパティ値

型パラメーターのカスタム属性を示す CodeAttributeDeclarationCollection。 既定値は、null です。

次のコード例は、 プロパティを使用 CustomAttributes して新しいカスタム属性を追加する方法を示しています。 この例は、 クラスに対して提供される大きな例の CodeTypeParameter 一部です。

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"))))

注釈

このプロパティを使用して、型パラメーターの宣言にメタデータ属性を追加できます。

注意事項

このプロパティは null 既定で、参照する前にチェックする必要があります。

適用対象

こちらもご覧ください