string json = "{\"hasM\":true,\"paths\":[[[0,0,1],[0,1,0],[1,1,-1],[1,0,-2]]]}";
Polyline polyline = PolylineBuilderEx.FromJson(json);
Polyline outputPolyline = GeometryEngine.Instance.OrientByMs(polyline);
// The points of outputPolyline are (x, y, m): (1, 0, -2), (1, 1, -1), (0, 1, 0), (0, 0, 1)
// M-values of second part is not monotonic, so it won't change. The first part will change.
json = "{\"hasM\":true,\"paths\":[[[0,0,1],[0,1,0],[1,1,-1],[1,0,-2]],[[5,4,6],[6,4,5],[8,6,7]]]}";
polyline = PolylineBuilderEx.FromJson(json);
outputPolyline = GeometryEngine.Instance.OrientByMs(polyline);
// The points of part 0 of outputPolyline are (x, y, m): (1, 0, -2), (1, 1, -1), (0, 1, 0), (0, 0, 1)
// The points of part 1 of outputPolyline are (x, y, m): (5, 4, 6), (6, 4, 5), (8, 6, 7)