Using List.Sort with delegates in C# script component ?

Hi!

I'm trying to sort a list of Polylines based on Z values within a C# script component using the List.Sort method and a delegate. However, after compiled, an error of 'not a delegate type' appears. Is there some way to create a delegate to do this ? Does it require the addition of another import such as system.linq ?

private void RunScript(List<Polyline> TopoCurves, object y, ref object A)
{

TopoCurves.Sort(delegate(Polyline a, Polyline b)
{
     return a.First.Z > b.First.Z;
});
}

  • up

    peter fotiadis

    I'll prepare a "simple" example using a variety of sorting methods (and a challenge for the brave, he he).

    In the mean time get the simplest possible way

    6