Want to look at how your classes are designed at a high level? How hard can it be?
Tuesday, October 09, 2018 4:18 PM
Are you using Visual Studio 2017 Enterprise? Did you know you have access to a too called Class Designer? It’s simply awesome! It will qucikly give you a a birds eye view of your classes and their inheritance structure. It’s awesome!
However, if you’re using Visual Studio Professional, you will have a hard time finding it. How come? Well, “technically” you DO have it, you just need to work a bit hard for it. Specifically you will need to go back to your Visual Studio application in Programs and Features in Control Panel and install it.
Here’s the Coles Notes version (hey, if you’re reading this, chances are you know what to do now LOL).
To use Class Designer, just know that (by default) you will be adding a new ClassDiagram1.cd file to your project (so it’s not completely free, but the cost is negligible). Right click on your class file of interest, then select the View Class Diagram option.
After that you’ll see one class on a canvas. Right click it and select Expand (or use the NUM + key). You’ll see the methods and properties show up. Next right click and select Show Derived Classes. Again, select Num + or right click and Expand to see more details. Continue until you’re happy with understanding the class hierarchy. Next, notice up top, it will say ClassDiagram1.cd* (notice the asterisks). That’ cause the file hasn’t been saved yet, you could save it for future reference if you wanted, or just blow it away and recreate later if need\want.
For the sample project I whipped up to illustrate what you would see, here’s what the class diagram looks like, and more importantly, what types of information you can glean from it. What is also really cool about the class diagram is, you can double click in it and navigate to that class’s code, it’s another way to navigate your code (in addition to the Solution Explorer).
There you have it, a quick way to get a high level understanding of your class structure\hierarchy. Now that you know how, it’s not that hard.