How to: View Existing Types (Class Designer)

In Class Designer, you can view the structure of an existing type in a Visual Studio project by displaying its corresponding shape on a class diagram. The shape contains compartments that display the members belonging to the type.

You can view local and referenced types. A local type exists in a currently open project and is read/write. A referenced type exists in another project or in a referenced assembly and is read-only.

To create new types on class diagrams, see How to: Create Types by using Class Designer.

To display types in a project on a class diagram

  1. From the project node in Solution Explorer, open a class diagram (.cd) file.

    Tip

    If no class diagram exists, add a class diagram to the project. For more information, see How to: Add Class Diagrams to Projects (Class Designer).

  2. From the project node in Solution Explorer, drag a source code file to the class diagram.

    Shapes representing the types defined in the source code file appear on the diagram at the position where you dragged the file.

You can also view types in the project by dragging one or more types from the project node in Class View to the class diagram.

Tip

If Class View is not open, open Class View from the View menu. For more information about Class View, see Viewing Classes and Their Members.

To display types at default locations on the diagram, select one or more types in Class View, right-click the selected types, and choose View Class Diagram.

Note

If a closed class diagram containing the type already exists in the project, the class diagram opens to display the type shape. However, if no class diagram containing the type exists in the project, Class Designer creates a new class diagram in the project and opens it to display the type.

When you first display a type on the diagram, its shape appears collapsed by default. You can expand the shape to view its contents.

To display a project or namespace in a class diagram

  • In Solution Explorer (for projects) or Class View (for namespaces) right-click the project or namespace and choose View In Diagram.

    An auto-populated Class Diagram is created.

See Also

Tasks

How to: View Inheritance Between Types (Class Designer)

How to: Customize Class Diagrams (Class Designer)

Other Resources

Viewing Types and Relationships (Class Designer)