开发者

Reverse engineering class diagram – inheritance and association relationships in particular – from an existing C# project

开发者 https://www.devze.com 2023-02-02 15:24 出处:网络
Folks, I’ve got am SDK-like package, which has a C# project, which I need to use as a reference design for my own project.When I open the reference project in VS2008 and run Class Diagram editor sho

Folks,

I’ve got am SDK-like package, which has a C# project, which I need to use as a reference design for my own project. When I open the reference project in VS2008 and run Class Diagram editor shows classes, class members, but it doesn’t show any relationships between classes.

  • Can the Class Diagram editor in VS2008 reverse engineer class relationships?
  • Are there plugins that can help?
  • Out of curiosity, can VS2010 do this?

Any suggestion, insight or开发者_运维知识库 reference is appreciated!

At the moment, I'm checking out StarUML: haven't made it work yet, haven't given up either.

- Nick


You may want to try doxygen with graphviz support. It can generate class relational diagrams from source. They're basic and they sometimes get generics/templates wrong, but it's better than nothing.


Disclaimer: this is my experience with Visual Studio 2010 Premium, but I recall VS2008 Professional works the same way.

Once you create a new Class Diagram via Add New Item, all you need to do is just drag the source code files from the Solution Explorer onto the Class Diagram's design surface.

Unfortunately there are some manual steps to getting the relationships on the diagram. What I end up doing is selecting the members I'm interested in on the diagram, and then choosing menu options from the Class Diagram menu (or right-clicking).

For example for properties you can choose Show Association or Show as Collection Association. With the entire type selected you can opt to show its base type and derived types from the same menu.

This should render the relationships like you're wanting.

0

精彩评论

暂无评论...
验证码 换一张
取 消