Help with Sort function in Rhino API -- RhinoList<T>.Sort

I am trying to sort a list of curves by its length. I am using the RhinoList.Sort Method (Double) method from the API but every time I assign it to a output variable I have this error: 1. Error (CS0029): Cannot implicitly convert type 'void' to 'object' (line 84)

  private void RunScript(Brep _Brep, ref object edges, ref object centroid_, ref object length_, ref object sortedCurves)
    // Get the edges of the solid
    Rhino.Geometry.Collections.BrepCurveList curveBrepType = _Brep.Curves3D;
    Rhino.Collections.RhinoList<Curve> curveCurveType = new Rhino.Collections.RhinoList<Curve>();

    // This for loop helps to convert from a BrepCurveList to a CurveType list
    for (int i = 0; i < _Brep.Curves3D.Count; i++)

    // Calculates teh center of the gravity of the brep
    Rhino.Geometry.Point3d centroidBrep = new Rhino.Geometry.Point3d();
    centroidBrep = VolumeMassProperties.Compute(_Brep).Centroid;

    // Get the dimension of a curve
    int listLength = curveBrepType.Count;
    Rhino.Collections.RhinoList <double> curveLength = new  Rhino.Collections.RhinoList<double>();

    for (int i = 0; i < listLength; i++)
      double lengthOfCurve = _Brep.Curves3D[i].GetLength();

    // Sort by length
    double[] curveLengthArray;
    curveLengthArray = curveLength.ToArray();
    sortedCurves = curveCurveType.Sort(curveLengthArray);

    // Outputs
    edges = curveBrepType;
    centroid_ = centroidBrep;
    length_ = curveLength;


I think I am following @DavidRutten advice based on his response for a similar question back in 2012 RhinoList Sort method question. What am I missing here :confused: ?

SortUsingCSharpRhino.3dm (21.8 KB) (5.9 KB)

The sort method your are using sorts the list in place and returns void:

So line #28 from your code is trying to assign void to your output parameter:

Your code works as expected if you change it to this:


Thanks @kev.r