18.1. Creating a Class Diagram

The design process for an application typically involves at least a sketch of the classes that are going to be created and how they interact. Visual Studio 2008 provides a design surface, called the Class Designer, onto which classes can be drawn to form a class diagram. Fields, properties, and methods can then be added to the classes, and relationships can be established among classes. Although this design is called a class diagram, it supports classes, structures, enumeration, interfaces, abstract classes, and delegates.

Before you can start working with a class diagram, you need to add one to the project. This can be done by adding a new Class Diagram to a project as shown in Figure 18-1, selecting the View Class Diagram button from the toolbar in the Solution Explorer window, or right-clicking a project or class and selecting the View Class Diagram menu item. The new Class Diagram option will simply create a new blank class diagram within the project.

Figure 18.1. Figure 18-1

A class diagram using the menu items on the Solution Explorer can behave in different ways, depending on whether a project or a class was highlighted. If the project was selected and an existing diagram does not exist in the project, the Class Designer will automatically add all the types defined within a project to the initial class diagram. Although this may be desirable, ...

Get Professional Visual Studio® 2008 now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.