var seller = new User(1);
for (var i = 0; i < 3; ++i)
seller.Children.Add(new User(1));
foreach (var child in seller.Children)
{
for (var i = 0; i < 3; ++i)
child.Children.Add(new User(1));
foreach (var child2 in child.Children)
{
for (var i = 0; i < 3; ++i)
child2.Children.Add(new User(1));
foreach (var child3 in child2.Children)
for (var i = 0; i < 3; ++i)
child3.Children.Add(new User(1));
}
}
I’m trying to create a tree of objects where each level has 3 objects. I know there’s a way to make this a recursive function
And the initial call should be