I'm trying to make a generic Type to handle all my references between C# entities.
- In one case, a
reference
is simply anint
ID, so the proper data structure to remember where ans entity it is been used, would beHashSet<int>
- In other scenario, An entity could be used in tree structure, so I need to remember both
int
Id and path which is a collection of objects. The proper data structure would aDictionary<int, Tvalue>
Here is What I have so far:
public class References<TValue> : Dictionary<int, TValue>
{
}
public class References : HashSet<int>
{
}
public class MyEntityWithDefaultReferences
{
public References References;
}
public class MyEntityWithPathReferences<PathType>
{
public References<PathType> References;
}
Is there a way to make second References
class inherit from the first one? So I can use parent class every where.