⬆️ ⬇️

Using the Class Designer Utility in Visual Studio 2010

Having learned about the competition for Habré, I wanted to write about Visual Studio from the very first day of its holding, but could not find a suitable topic. As a result, I remembered an interesting utility called Class Designer , which many gurus of this product from Microsoft probably know, but it would be very useful for new users of Visual Studio to learn 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.



Appearance utility



In order to add it to the project you need to open the Solution Explorer window (which is clearly visible on the first screenshot on the right), select our project there (for example, I used my old well-known test toy life) and click on the View Class Diagram button ".





Now we see what I have 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 have chosen.

')





There are also filtering buttons by methods, properties, events and fields, as well as a button for creating a new method / field / property / event / designer / destructor.



And now let's click on any class used in your project (in my application everything fit in Form1) with the right mouse button and in the context menu that appears, select Add-> Method and we will see the following 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: the 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 the types used.



Also, as I think many have previously noted, Class Designer allows for refactoring and tracking “related”, or rather “hereditary” connections with other classes.



But that's not all! The utility also allows you to drag classes onto diagrams, building them into a more user-friendly view. You can also right-click on an empty place and in the drop-down menu you can see parameters such as Zoom, Group members, Layot diagram and Adjust shapes width, which also allow you to change the visual representation of the classes in 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 main functions of Class Designer, which can simplify the process of building the structure of the application, and simply do 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 familiarize it with those users who, like I once did not know about its existence for some time ago.

Source: https://habr.com/ru/post/97692/



All Articles