string json = "{\"hasM\":true,\"paths\":[[[-2000,0,1],[-1000,1000,-1],[-1000,0,3],[1000,1000,4],[2000,1000,5],[2000,2000,6],[3000,2000,7],[4000,0,8]]],\"spatialReference\":{\"wkid\":3857}}";
Polyline polyline = PolylineBuilderEx.FromJson(json);
// Get the subcurve between M-values 2 and 6
MSubCurveRelation fromDetail, toDetail;
Polyline subCurve = GeometryEngine.Instance.GetSubCurveBetweenMsEx(polyline, 2, 6, out fromDetail, out toDetail);
// The subcurve has one part and five points. The subcurve points are (x, y, m):
// (-1000, 250, 2), (-1000, 0, 3), (1000, 1000, 4), (2000, 1000, 5), (2000, 2000, 6)
// fromDetail = toDetail = MSubCurveRelation.MBetweenMinMax
// Get the subcurve between M-values -2 and 3.5
subCurve = GeometryEngine.Instance.GetSubCurveBetweenMsEx(polyline, -2, 3.5, out fromDetail, out toDetail);
// The subcurve has two parts and five points.
// The subcurve points in part 0 are (x, y, m): (-1000, 1000, -1), (-2000, 0, 1)
// The subcurve points in part 1 are (x, y, m): (-1000, 1000, -1), (-1000, 0, 3), (0, 500, 3.5)
// fromDetail = MSubCurveRelation.MBelowMin, toDetail = MSubCurveRelation.MBetweenMinMax