ClassDiagram Class
A class diagram: classes with their attributes and methods, linked by relations (inheritance, composition, association...), grouped in namespaces (Mermaid classDiagram).
public sealed class ClassDiagram : Diagram- Inheritance
DiagramClassDiagram
Constructors
| Name | Description |
|---|---|
| ClassDiagram() |
ClassDiagram()
ClassDiagram.cspublic ClassDiagram()No documentation is available.
Properties
| Name | Description |
|---|---|
| ClassDefinitions | Gets the styles of the CSS classes of the elements, by name (Mermaid classDef). The class default applies to every class. |
| Classes | Gets the classes. The classes of the namespaces that are not in this list are drawn too. |
| Direction | Gets or sets the direction of the relations. The default is DiagramDirection.TopToBottom. |
| HideEmptyMembersBox | Gets or sets a value that indicates whether a class without members has no empty compartments (Mermaid hideEmptyMembersBox). |
| Interfaces | Gets the interfaces drawn as lollipops. |
| Namespaces | Gets the top-level namespaces. |
| Notes | Gets the notes. |
| Relations | Gets the relations, drawn in order. |
ClassDefinitions
ClassDiagram.csGets the styles of the CSS classes of the elements, by name (Mermaid classDef). The class default applies to every class.
public IDictionary<string, DiagramStyle> ClassDefinitions { get; }Property value
Classes
ClassDiagram.csGets the classes. The classes of the namespaces that are not in this list are drawn too.
public IList<ClassDiagramClass> Classes { get; }Property value
Direction
ClassDiagram.csGets or sets the direction of the relations. The default is DiagramDirection.TopToBottom.
public DiagramDirection Direction { get; set; }Property value
HideEmptyMembersBox
ClassDiagram.csInterfaces
ClassDiagram.csGets the interfaces drawn as lollipops.
public IList<ClassDiagramInterface> Interfaces { get; }Property value
Namespaces
ClassDiagram.csNotes
ClassDiagram.csRelations
ClassDiagram.csMethods
| Name | Description |
|---|---|
| AddClass(string, DiagramText?) | Adds a class. |
| AddNamespace(string, DiagramText?) | Adds a top-level namespace. |
| AddNote(DiagramText, ClassDiagramClass?) | Adds a note. |
| AddRelation(ClassDiagramElement, ClassDiagramElement, ClassRelationEnd, ClassRelationEnd, DiagramText?) | Adds a relation. |
| EnumerateNamespaces() | Enumerates the namespaces and their nested namespaces, depth first. |
| Find(string) | Finds a class or an interface by identifier, in the diagram and its namespaces. |
AddClass(string, DiagramText?)
ClassDiagram.csAdds a class.
public ClassDiagramClass AddClass(string id, DiagramText? label = null)Parameters
idstring- The identifier, which is the name shown when there is no label.
labelDiagramText?- The name shown, or
nullto show the identifier.
Returns
ClassDiagramClass The class.
AddNamespace(string, DiagramText?)
ClassDiagram.csAdds a top-level namespace.
public ClassDiagramNamespace AddNamespace(string id, DiagramText? label = null)Parameters
idstring- The identifier.
labelDiagramText?- The title, or
nullto show the identifier.
Returns
ClassDiagramNamespace The namespace.
AddNote(DiagramText, ClassDiagramClass?)
ClassDiagram.csAdds a note.
public ClassDiagramNote AddNote(DiagramText text, ClassDiagramClass? @class = null)Parameters
textDiagramText- The text.
classClassDiagramClass?- The class the note is attached to, or
nullfor a note alone.
Returns
ClassDiagramNote The note.
AddRelation(ClassDiagramElement, ClassDiagramElement, ClassRelationEnd, ClassRelationEnd, DiagramText?)
ClassDiagram.csAdds a relation.
public ClassRelation AddRelation(ClassDiagramElement from, ClassDiagramElement to, ClassRelationEnd fromEnd = ClassRelationEnd.None, ClassRelationEnd toEnd = ClassRelationEnd.None, DiagramText? label = null)Parameters
fromClassDiagramElement- The first element.
toClassDiagramElement- The second element.
fromEndClassRelationEnd- The decoration at
from. toEndClassRelationEnd- The decoration at
to. labelDiagramText?- The text of the relation, or
nullfor none.
Returns
ClassRelation The relation.
EnumerateNamespaces()
ClassDiagram.csEnumerates the namespaces and their nested namespaces, depth first.
public IEnumerable<ClassDiagramNamespace> EnumerateNamespaces()Returns
IEnumerable<ClassDiagramNamespace> The namespaces.
Find(string)
ClassDiagram.csFinds a class or an interface by identifier, in the diagram and its namespaces.
public ClassDiagramElement? Find(string id)Parameters
idstring- The identifier.
Returns
ClassDiagramElement? The element, or null when there is none.