This documentation is archived and is not being maintained.

How to: Apply Custom Attributes to Types or Type Members

You can apply a custom attribute to a type or to a member of a type. For more information about attributes, see Attributes (C# Programming Guide), Attributes Alphabetical Reference, or Attributes in Visual Basic.

To apply a custom attribute to a type

  1. Click the type's shape on a class diagram.

  2. In the Properties window, next to the Custom Attributes property for the type, click the ellipsis (…) button. The Attribute Editor dialog box is displayed.

  3. In the Attribute Editor, type one or more custom attributes. Separate attributes on new lines, but do not enclose them in brackets. When you are finished, click OK.

    The custom attributes you entered are applied to the type.

To apply a custom attribute to a type member

  1. Click the member's name in its type's shape on a class diagram, or its row in the Class Details window.

  2. In the Properties window, locate the Custom Attributes property for the member.

  3. Type one or more custom attributes (one per line), and press Enter.

    The custom attributes you entered are applied to the type.

Show: