Search code examples
c#umlrelationships

UML Representation in specific cases of C# Application


I have some UML representation of Class Relationship (Association, Aggregation and Composition) questions

  1. In a C# Windows program we always have the Program Calls with Main(). This Main() calls our form say Form1.

    What is the relationship between Class Program and Class Form1

  2. A Class C1 has a method M1 which takes one parameter of type Enum Flag

    What is the relationship between Class C1 and Enum Flag

  3. Class C1 has a property List collection of C2 objects where C2 is another class

    What is the relationship between Class C1 and Class C2

  4. Form 1 calls a customer dialog Form 2 to get a value

    What is the relationship between Class Form1 and Class Form2

  5. Class C1 has a property of type Enum Flag

    What is the relationship between Class C1 and Enum Flag

Thank you


Solution

    1. This is an association Main-->Form1 where you would put the role name (e.g. theForm1) on the right side of the association
    2. This is a simple dependency C1 - - >Flag
    3. Also a simple association with multiplicity on the C2 side of the association. Use composite aggregation only of you want to connect the lifetime of the aggregated children to their aggregator.
    4. This is the same as 1.
    5. This is the same as 2.