I have a custom class derived from a library (Satsuma) as follows:
public class DCBaseNode : Node { public bool selected = false; }
and Neighbors in the library, which returns a List<Node> . I want to be able to do this:
graph.Neighbors(theNode).Any(n => n.selected == true);
But Any sees n as Node , not DCBaseNode , so it doesn't understand .selected .
So I tried:
graph.Neighbors(theNode).Any<DCBaseNode>(n => n.selected == true);
... which gives me this error:
Error CS1928: type System.Collections.Generic.List<Satsuma.Node>' does not contain a member Any' and is the best extension overload method. System.Linq.Enumerable.Any (this System.Collections.Generic.IEnumerable, System.Func) 'has some invalid arguments
... but I do not understand how the arguments are invalid.
source share