You can edit a common language runtime (CLR) attribute to an element in a diagram by using the Custom Attribute property, and then you can reference the attribute in your code.
To edit attributes on a diagram element
In the diagram or DSL Explorer, click the element to which you want to assign an attribute.
In the Properties window, next to the Custom Attribute property, click the Browse (...) icon.
The Edit Attributes dialog box opens.
In the Name column, click <add attribute>, type the name of your attribute (for example, MyAttribute), and then press SPACEBAR.
注意
An attribute cannot start with a numeric value or contain spaces.
Below the name of your attribute, after the bracket, type a parameter for the attribute (for example, string), and then press ENTER.
In the Name Property column, type an applicable name (for example, MyString).
Repeat steps 4 and 5 for each additional parameter that you want to add to the attribute.
If you want to add another attribute to the element, repeat these steps. Otherwise, click OK.
The Custom Attributes property in the Properties window reflects your entries in the following example:
[MyAttribute(MyString=string)]