I want to flatten a hierarchy of objects with an open Generic T
.
This link Recursive List Flattening
shows how to do that taking a passed IEnumerable. But I want to flatten a passed object T and
its property Children in a generic and recursively way.
U1.Children(U2,U3,U4)
U2.Children(U9,U10)
U3.Children(U11,U12)
U4.Children(U20,U30)
I pass to the method U1
(selected node) and I want to get this flat list:
U1,U2,U3,U4,U9,U10,U11,U12,U20,U30
Is that possible somehow in a generic way?