Back to Home

Using Class Designer in Visual Studio 2010

Visual Studio 2010 Contest

Using Class Designer in Visual Studio 2010

    Having learned about the competition on the hub, from the very first day of its holding I wanted to write about Visual Studio, but I could not find a suitable topic. As a result, I remembered about an interesting utility called Class Designer , which many gurus of this product from Microsoft probably know about, but it would be very useful for new Visual Studio users to find out about it.

    What is this notorious Class Designer. This is a small utility that is part of Visual Studio, which allows you to present all classes and members in your project in an intuitive hierarchical structure. In addition, it allows you to create class objects, add new methods, variables and the classes themselves. Utility appearance



    In order to add it to the project, you need to open the Solution Explorer window (which is clearly visible in the first screenshot on the right), select our project there (for example, I used my old test notorious toy program life) and click on the button “View Class Diagram ". Now we see what is presented in the first screenshot: a visual diagram of the project classes and the dependencies between them, as well as the window below, which lists all the methods, objects, fields, properties and events of the class we selected. There are also buttons for filtering by methods, properties, events and fields, as well as a button for creating a new method / field / property / event / constructor / destructor.








    And now let's click on any class used in your project (everything fit in Form1 in my application) with the right mouse button and select Add-> Method in the context menu that appears and we will see the next picture in which we just need to type the name of the method. And here is the code automatically generated by Visual Studio. The same operation can be done with properties, fields, events, and class constructors. Note: a list of all types used in the class can be viewed by clicking on the arrow in the upper right corner of the corresponding class, and you will see a drop-down menu with a list of all used types.









    Also, as I think many have previously noticed, Class Designer allows you to refactor and track "related", or rather "hereditary" relationships with other classes.

    But that's not all! The utility also allows you to drag classes onto diagrams, arranging them in a more user-friendly way. You can also right-click on an empty place and in the drop-down menu you can see such parameters as Zoom, Group members, Layot diagram and Adjust shapes width, which also allow you to change the visual representation of classes on the diagram.

    And in the same drop-down menu, you might notice the Add item, which allows you to add classes, enumerations, structures, interfaces and comments.

    I hope that I was able to show the basic functions of Class Designer, which can simplify the process of building the structure of the application, and simply can not get confused in a complex system of classes and their members.
    I did not set myself the goal of making a complete and detailed overview of every little thing that is in this utility, I just wanted to acquaint users with it who, as I had once and some time ago, did not know about its existence.

    Read Next