January 2012
Intermediate to advanced
396 pages
8h 16m
English
Let's say we have an array of points in 2D and we want to sort them as per their X co-ordinates. Here is how to do it:
System.Drawing.PointF[] points =
{
new System.Drawing.PointF(0, -1),
new System.Drawing.PointF(-1, 1),
new System.Drawing.PointF(3, 3)
};
var sortedPoints = points.Select(c=>new {X = c.X, Y = c.Y}).OrderBy(c => c.X).ToList();
sortedPoints.Dump("Sorted Points");
We have a List of points in 2D and we wanted to sort them by their X co-ordinates. We created ...
Read now
Unlock full access