I have a list of nodes, each node has a reference to its previous node and its next node. I want a list of the nodes which do not share the next or the previous ones. In other words, a list of nodes that are not sequenced.
nodes= nodes.Where(o => !nodes.Any(oo => ReferenceEquals(oo.NextNode, o.PreviousNode)));
It throws this exception
An unhandled exception of type 'System.StackOverflowException' occurred in NodeLib.dll
I don't know what I am missing or misunderstanding. Thank you in advance!