I have a class Element
with the properties Id (which is unique) SuperElement
, which is above my Element
and a List of SubElements
which are below my Element
.
public class Element
{
public string Id { get; set; }
public Element SuperElement { get; set; }
public List<Element> SubElements { get; set; }
}
In the end this thing looks like a graph with a single node at the beginning, which is my root element and each with a list of elements below. Is there any class in C# where this pattern is already implemented? I want methods to insert a new ID at the right point within that graph + find elements by Id in that graph + iterate through all elements in that graph and so on.