Creating custom sort for Curves in C#

Hello everyone! Can one create a custom sort for curves?

Example code:

x.Sort(new CustomCompare());

///

class CustomCompare : IComparer
{
public int CompareRegionRelashionship(Curve x, Curve y)
{
if ( x.GetLength() > y.GetLength())
{
return 1;
}
else if (x.GetLength()<y.GetLength()) // If x is inside y
{
return -1;
}
else
{
return 0;
}
}
}

Error (CS0535): ‘Script_Instance.CustomCompare’ does not implement interface member ‘System.Collections.Generic.IComparer<Rhino.Geometry.Curve>.Compare(Rhino.Geometry.Curve, Rhino.Geometry.Curve)’

This should be renamed. Also you must implement the generic interface.

Hello Menno, thank you for your reply.

Could you give me a hint on how a generic interface is implemented? I have read various posts and microsoft articles, but I cannot

Error examples:

Warning (CS0114): ‘Script_Instance.CustomCompare.Compare(Rhino.Geometry.Curve, Rhino.Geometry.Curve)’ hides inherited member ‘System.Collections.Generic.Comparer<Rhino.Geometry.Curve>.Compare(Rhino.Geometry.Curve, Rhino.Geometry.Curve)’. To make the current member override that implementation, add the override keyword. Otherwise add the new keyword. (line 66)

PS: already tried using the override keyword

Error (CS0534): ‘Script_Instance.CustomCompare’ does not implement inherited abstract member ‘System.Collections.Generic.Comparer<Rhino.Geometry.Curve>.Compare(Rhino.Geometry.Curve, Rhino.Geometry.Curve)’ (line 64)

This one pops up often.

I don’t even understand if I am very far off from a correct implementation or if I have some keywords to adjust.

Any kind of tip would be very appreciated.

class CustomCurveCompare : IComparer<Rhino.Geometry.Curve>
{
  public int Compare(Curve x, Curve y)
  {
    if (x.GetLength() > y.GetLength())
    {
      return 1;
    }

    if (x.GetLength() < y.GetLength()) // If x is inside y
    {
      return -1;
    }

    return 0;
  }
}

// then to sort
List<Rhino.Geometry.Curve> list = new List<Curve>();
// TODO: add items to the list
list.Sort(new CustomCurveCompare());

Thank you!