One Generic list that contain Points say =>List<Point>
Now I need to filter points and store it in another List<Point> as per below condition and Using LINQ.
• At given Y value of Point
• Find Points with Maximum X values and Minimum X values.
NOTE:
Actually friends, I am looking for the LINQ query which performs above operation in just single query if possible.
Otherwise any best solution for above operation using LINQ,
EDIT:-
see my code here but i am looking for sort solution…..
int givenY = 147;
List<Point> listOfPointLocal = (from point in listOfPointMain
where point.Y == givenY
select point).ToList();
var minX = listOfPointLocal.Min(p => p.X);
var maxX = listOfPointLocal.Max(p => p.X);
List<Point> listOfFilterdPoint = (from p in listOfPointLocal
where p.X <= minX || p.X >= maxX
select p).ToList();
Thanks…..
With a little help from an extra class you can pass the list only once.
And then