Answered by:
How to find the maximize & minimum points from List<Point> ?
Question
Answers

List
<Point> points = new List<Point>();
points.Add(
new Point(10, 10));
points.Add(
new Point(20, 10));
points.Add(
new Point(30, 10));
// Simple extension methods on a list
int maxX = points.Max(e => e.X); // returns 30
int minX = points.Min(e => e.X); // returns 10
int maxXY = points.Max(e => (e.X + e.Y)); // returns 40
// Or with LINQ to return the point
var r = (from t in points select t).Min(e => e.X);
Hope this helps!
AFGADFG Proposed as answer by Stuart Phillips Wednesday, August 25, 2010 10:38 PM
 Marked as answer by Alan_chenModerator Monday, August 30, 2010 1:05 AM

Hi ronili2,
Welcome to MSDN forums!
I am interested in helping.
Every point has X and Y, the minimum/maximum of X and Y may not in a point.
So you may give us the rule of min/max.
As Stuart answer, Linq is an easy and good way to deal with it.
System.Collections Namespace
http://msdn.microsoft.com/enus/library/system.collections(VS.71).aspx
There are many ways comparing two objects.
Hope these helps, if you have any problems, please feel free to let me know.
Best Regards,
Alan Chen
________________________________________
Please remember to mark the replies as answers if they help and unmark them if they provide no help
 Marked as answer by Alan_chenModerator Monday, August 30, 2010 1:05 AM
All replies

List
<Point> points = new List<Point>();
points.Add(
new Point(10, 10));
points.Add(
new Point(20, 10));
points.Add(
new Point(30, 10));
// Simple extension methods on a list
int maxX = points.Max(e => e.X); // returns 30
int minX = points.Min(e => e.X); // returns 10
int maxXY = points.Max(e => (e.X + e.Y)); // returns 40
// Or with LINQ to return the point
var r = (from t in points select t).Min(e => e.X);
Hope this helps!
AFGADFG Proposed as answer by Stuart Phillips Wednesday, August 25, 2010 10:38 PM
 Marked as answer by Alan_chenModerator Monday, August 30, 2010 1:05 AM


Hi ronili2,
Welcome to MSDN forums!
I am interested in helping.
Every point has X and Y, the minimum/maximum of X and Y may not in a point.
So you may give us the rule of min/max.
As Stuart answer, Linq is an easy and good way to deal with it.
System.Collections Namespace
http://msdn.microsoft.com/enus/library/system.collections(VS.71).aspx
There are many ways comparing two objects.
Hope these helps, if you have any problems, please feel free to let me know.
Best Regards,
Alan Chen
________________________________________
Please remember to mark the replies as answers if they help and unmark them if they provide no help
 Marked as answer by Alan_chenModerator Monday, August 30, 2010 1:05 AM