I have a simple tree structure represented like this:
Node
{
int Id;
int ParentId;
int Name;
}
Using LINQ with a List<Node>, how can I select all nodes that doesn’t have a parent in the same list?
Example:
Id ParentId
1 0
2 1
3 1
4 2
5 4
8 6
In the above table, Nodes with Id 1 and 8 doesn’t have a parent in the set.
or:
or: