c# - How should I change this source into LINQ? -
list<node> resultlist = new list<node>(); nodeequalitycomparer comparer = new nodeequalitycomparer(); foreach (vector3 move in movelist) { foreach (node sight in sightlist) { if (comparer.equals((vector3)sight.position, move)) resultlist.add(sight); } }
how should change source linq?
var resultlist = movelist.selectmany(m => sightlist.where( s => comparer .equals((vector3)s.position, m)).tolist();