Reputation: 73
I have problem with dependencies in class diagram. I use these classes
class data and class algorithm
What is the relationship between classes? Thank you for your help
Data.cs =>
public class Data {
public string Data1 { get; set; }
public string Data2 { get; set; }
public Data(string data1, string data2)
{
this.Data1 = data1;
this.Data2 = data2;
}
public string data1data2()
{
return Data1 + " " + Data2;
}
}
Algorithm.cs =>
public static class Algorithm
{
public static void MethodData()
{
List<Data> data = new List<data>();
data.Add(new Data("aaaa", "bbb"));
.
.
foreach(Data item in data)
{
Console.WriteLine(item.data1data2());
}
.
}
}
Upvotes: 1
Views: 924
Reputation: 6871
Algorithm has a one to many relationship to Data. This can be seen by the presence of a field that holds a list (many) of data. One Algorithm knows about many data objects.
Data does not have any relationship to algorithm, because it does not have any fields of type Algorithm. Generally one would therefore draw the relationship with an arrow from Algorithm pointing at the Data object.
This may be helpful: Direction of the association arrow in UML class diagrams
Upvotes: 1