📜  c# 二维数组排序 - C# 代码示例

📅  最后修改于: 2022-03-11 14:49:06.137000             🧑  作者: Mango

代码示例1
static void Main()
{  // could just as easily be string...
    int[][] data = new int[][] { 
        new int[] {1,2,3}, 
        new int[] {2,3,4}, 
        new int[] {2,4,1} 
    }; 
    Sort(data, 2); 
} 
private static void Sort(T[][] data, int col) 
{ 
    Comparer comparer = Comparer.Default;
    Array.Sort(data, (x,y) => comparer.Compare(x[col],y[col])); 
}