CustomAttributes Property

CodeTypeParameter.CustomAttributes Property

 

Gets the custom attributes of the type parameter.

Namespace:   System.CodeDom
Assembly:  System (in System.dll)

public CodeAttributeDeclarationCollection CustomAttributes { get; }

Property Value

Type: System.CodeDom.CodeAttributeDeclarationCollection

A CodeAttributeDeclarationCollection that indicates the custom attributes of the type parameter. The default is null.

This property can be used to add metadata attributes to the declaration of the type parameter.

System_CAPS_cautionCaution

This property is null by default and should be checked before referencing.

The following code example shows the use of the CustomAttributes property to add a new custom attribute. This example is part of a larger example provided for the CodeTypeParameter class.

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

.NET Framework
Available since 2.0
Return to top
Show:
© 2016 Microsoft