我试图按列表中的最小整数值对列表进行排序.这是我到目前为止的地方.
var SortedList = from lists in List
orderby lists.List.Min(Min=>Min.value)
ascending
select list ;
Run Code Online (Sandbox Code Playgroud)
例如:
var x = new List<int>{ 5, 10, 4, 3, 0 };
var y = new List<int> { 4, -1, -5, 3, 2 };
var z = new List<int> { 3, 1, 0, -2, 2 };
var ListofLists = new List<List<int>> {x, y, z};
Run Code Online (Sandbox Code Playgroud)
我的Linq的输出应该是,按列表列表中的最小值对列表进行排序.我的示例中的列表序列如下:
y - > z - > x
我尝试了很多linq表达式并在网上搜索.问题似乎很简单......感谢您提供任何帮助!