如何对收集对象中的值进行排序和选择?

时间:2019-06-16 21:37:12

标签: c# generics linked-list

我的集合对象类MyGroup包含3个值。如何对收集对象中的值进行排序和挑选?

public class MyGroup
{
        public int RowIndex { get; set; } // Row Index
        public int ColumnIndex { get; set; } // Column Index
        public object ColumnValue { get; set; } // Column Value
}

Output would be as 

1,0,Sam
1,1,Miami
1,2,100
2,0,Charlie
2,1,Miami
2,2,100
3,0,Jean
3,1,Miami
3,2,200

从此列表值中,我将不得不选择列值的开始和结束行索引值:迈阿密

预期输出为..开始索引= 1,结束索引= 3。

在Dictionary中,只有键和值对,可以很容易地按max或min进行排序。当我们有一个具有3个或4个以上值的自定义集合对象时,我将不得不对它们进行排序。

0 个答案:

没有答案