Share via


How to: Create a Member

You can create a member using any of the following tools:

  • Class Designer

  • Class Details window toolbar

  • Class Details window

Note

You can also create constructors and destructors using the procedures in this section. Please bear in mind that constructors and destructors are special kinds of methods, and as such, they appear in the Methods compartment in class diagram shapes and in the Methods section of the Class Details window grid.

Note

The only entity you can add to a delegate is parameter. Note that the procedure entitled 'To Create a member using the Class Details Window toolbar' is not valid for this action.

To create a member using Class Designer

  1. Right-click the type to which you want to add a member, point to Add, and click Add <member>.

    A new member signature is created and added to the type. It is given a default name that you can change in Class Designer, the Class Details window, or in the Properties window.

  2. Optionally, specify other details about the member, such as its type.

To create a member using the Class Details Window toolbar

  1. On the diagram surface, select the type to which you want to add a member.

    The type obtains focus and its contents are displayed in the Class Details window.

  2. In the Class Details window toolbar, click the top icon and select New <member> from the drop-list.

    The cursor moves to the Name field in a row for the kind of member you want to add. For example, if you clicked New Property, the cursor moves to a new row in the Properties section of the Class Details window.

  3. Type the name of the member you want to create and press Enter (or otherwise move focus, such as by pressing Tab).

    A new member signature is created and added to the type. The member now exists in code and is displayed in Class Designer, the Class Details window, and the Properties window.

  4. Optionally, specify other details about the member, such as its type.

To create a member using the Class Details Window

  1. On the diagram surface, select the type to which you want to add a member.

    The type obtains focus and its contents are displayed in the Class Details window.

  2. In the Class Details window, in the section that contains the kind of member you want to add, click <add member>. For example, if you want to add a field, click <add field>.

  3. Type the name of the member you want to create and press Enter.

    A new member signature is created and added to the type. The member now exists in code and is displayed in the Class Designer, the Class Details window, and the Properties window.

  4. Optionally, specify other details about the member, such as its type.

    Note: You can also use keyboard shortcuts to create members. For more information, see Keyboard Shortcuts for the Class Details Window.

See Also

Tasks

How to: Modify Type Members

Concepts

Creating Type Members

Keyboard Shortcuts for the Class Details Window