I have a CustomObject with n Children. These children are a List of CustomObjects. Something like this:
public class CustomObject
{
public List<CustomObject> Children = new List<CustomObject>();
}
What I am looking for is the most performant way to get ALL n Children and their children and subchildren etc, from a single instance of CustomObject. Is there a better way than looping through all veigns until I reach the end (null)?
(C#, .NET 3.5)
To make it more clear, I will make an example structure:
//root object
CustomObject.Children ->
CustomObject.Children ->
CustomObject
CustomObject
CustomObject.Children ->
CustomObject.Children ->
CustomObject
CustomObject
CustomObject
In this case, I need to get ALL custom objects beneath the root object.