Gaurav
Gaurav

Reputation: 8487

How to create a C# class diagram in visual studio 2015/

I need to create a class diagram from my existing code. Suppose I have the following classes -

public class Person
{
   public string Name { get; set;} 
   public int Age { get; set;} 

   public Address Address { get; set; }
   public Education Education { get; set; }
}

public class Address
{
   public string AddressLine1 { get; set; }
   ....
}

public class Education
{
   public string CollegeName { get; set; }
   ....
}

I want to create a digram for Person class like:

enter image description here

I know about the UML diagram but it dosen't create what I am expecting. As far as I know it only creates the inheritence hierarchy.

I am using Visual Studio 2015 community edition. Can anyone tell me the tool to create the class digram as I mentioned above?

Thanks!

Upvotes: 7

Views: 5431

Answers (2)

Daniel Minnaar
Daniel Minnaar

Reputation: 6315

yUML is a Visual Studio extension which should layout your classes in the way you want.

It will automatically render your class and property associations using 'dependency links' without having to do it manually (using Class Diagram), but of course, it's an extension you'll need to download.

yUML Screenshot

Upvotes: 0

Orkhan Alikhanov
Orkhan Alikhanov

Reputation: 10070

Right click on .cs file having your classes and click on View Class Diagram: enter image description here

After that go to the class property you want and right click then choose Show As Association

enter image description here

Upvotes: 6

Related Questions