I am trying to select points from a drawing, sort them by northing and then by easting so that I can renumber them from north to south and then by west to east. I want to do this as efficiently as possible and I think linq would be the best way assuming I can work with a List<CogoPoint> in this manner.
This doesn't work yet. Is there a better way to do this or a different path I should take?
using (Transaction tr = db.TransactionManager.StartTransaction())
{
// ' If the prompt status is OK, objects were selected
if (acSSPrompt.Status == PromptStatus.OK)
{
ObjectIdCollection idcoll
= new ObjectIdCollection
(acSSPrompt
.Value.GetObjectIds());
foreach (ObjectId OID in idcoll)
{
CogoPoint p = (OID.GetObject(OpenMode.ForRead) as CogoPoint);
SelectedPoints.Append<CogoPoint>(p);
}
var sortresult = SelectedPoints.OrderByDescending(p.Northing).ThenByDescending(p.Easting);
//Renumber the points here
tr.Commit();
}
else
{
}
}//end using
Thank you,
Stacy