PowerDesigner represents C# events, indexers, and properties as standard UML attributes with additional properties.
For general information about creating and working with attributes, see Attributes (OOM).
To create an event, indexer, or property, open the property sheet of a type, click the Attributes tab, click the Add button at the bottom of the tab, and select the appropriate option.
Events – stereotype <<Event>> with one or two linked operations representing the add and/or remove handlers
Indexers – stereotype <<Indexer>> with one or two linked operations representing the get and/or set accessors
The visibility of the property is defined by the visibility of the get accessor operation if any, otherwise by that of the set accessor operation.
When an attribute becomes a property, an implementation attribute is automatically created to store the property value. The implementation attribute is not persistent and has a private visibility. It has the stereotype <<PropertyImplementation>> and has the same name than the property but starting with a lowercase character. If the property name already starts with a lower case its first character will be converted to uppercase.
The implementation attribute can be removed for properties not needing it. (calculated properties for instance)
If the boolean-valued extended attribute Extern is set to true, no operations should be linked to the property.
When a property declaration includes an extern modifier, the property is said to be an external property. Because an external property declaration provides no actual implementation, each of its accessor-declarations consists of a semicolon.
Event, indexer, and property property sheets contain all the standard attribute tabs along with the C# tab, the properties of which are listed below:
Property |
Description |
---|---|
Compilation Unit |
Specifies the compilation unit in which the attribute will be stored. This field is only available if the parent type is a partial type (allocated to more than one compilation unit). |
New |
Specifies the new modifier for the attribute declaration. |
Unsafe |
Specifies the unsafe modifier for the attribute declaration. |
Abstract |
Specifies the abstract modifier for the attribute declaration. |
Extern |
Specifies the extern modifier for the attribute declaration. |
Override |
Specifies the override modifier for the attribute declaration. |
Sealed |
Specifies the sealed modifier for the attribute declaration. |
Virtual |
Specifies the virtual modifier for the attribute declaration. |
In the following example, class Employee contains 2 properties. The Setter operation has been removed for property TimeReport: