C
cbmeeks
Hello all.
I have a project that I am working on and I need some suggestions.
First, I have a class that contains a value and a reference to a
parent class.
For example:
public class Data
{
public Data ParentClass;
public double Value;
}
....
Data d1 = new Data();
d1.Value = 100;
Data d2 = new Data();
d2.Value = 50;
d2.ParentClass = d1;
There is actually a lot more to the class but you get the idea.
Now, at this point I can easily find the value of d1 from d2 by
running "up the tree".
But my question is, how do I run down the tree?
For example, if a user only knew about d1, how could he know that d1
has "children" of d2? For that matter, d1 could have hundreds of
children.
I thought about using a "Data Container" that would contain a List of
Data classes but I'm not sure if that's the best way.
Thanks for any suggestions.
cbmeeks
I have a project that I am working on and I need some suggestions.
First, I have a class that contains a value and a reference to a
parent class.
For example:
public class Data
{
public Data ParentClass;
public double Value;
}
....
Data d1 = new Data();
d1.Value = 100;
Data d2 = new Data();
d2.Value = 50;
d2.ParentClass = d1;
There is actually a lot more to the class but you get the idea.
Now, at this point I can easily find the value of d1 from d2 by
running "up the tree".
But my question is, how do I run down the tree?
For example, if a user only knew about d1, how could he know that d1
has "children" of d2? For that matter, d1 could have hundreds of
children.
I thought about using a "Data Container" that would contain a List of
Data classes but I'm not sure if that's the best way.
Thanks for any suggestions.
cbmeeks