First, the definition of T in List is as follows:
/// <summary> /// Parameters in GeoJSON format /// </summary> public class BodyParamShapeDistance { /// <summary> /// Geometry object /// </summary> [Newtonsoft.Json.JsonProperty("Shape")] public GeoJSON.Net.Geometry.IGeometryObject Shape { get; set; } /// <summary> /// distance /// </summary> [Newtonsoft.Json.JsonProperty("Distance")] public double Distance { get; set; } }We define a List<T>:
List<BodyParamShapeDistance> lsResult = new List<BodyParamShapeDistance>() { };And assign a value to it (code omitted).
Then, sort by its Distance:
lsResult.OrderBy((e1) => { return System.Convert.ToDouble(e1.Distance); }).ToList()The result is as follows:
[ { "Shape": { "type": "Point", "coordinates": [ 13733091.6109, 5126223.190200001 ] }, "Distance": 0.6398240774310442 }, { "Shape": { "type": "Point", "coordinates": [ 13733110.031999998, 5126207.581500001 ] }, "Distance": 24.49381893718201 }, { "Shape": { "type": "Point", "coordinates": [ 13733116.322999999, 5126215.005900003 ] }, "Distance": 26.55484821473176 }, { "Shape": { "type": "Point", "coordinates": [ 13733116.5524, 5126215.2766999975 ] }, "Distance": 26.69409126958543 }, { "Shape": { "type": "Point", "coordinates": [ 13733117.426799998, 5126216.308700003 ] }, "Distance": 27.260763998304128 }, { "Shape": { "type": "Point", "coordinates": [ 13733111.483900003, 5126241.340800002 ] }, "Distance": 27.495001437711842 }, { "Shape": { "type": "Point", "coordinates": [ 13733089.886, 5126250.759099998 ] }, "Distance": 27.78144396311649 }, { "Shape": { "type": "Point", "coordinates": [ 13733118.289399996, 5126217.326700002 ] }, "Distance": 27.872884404584443 } ]