我正在尝试在这里对我的课程进行排序。我的代码如下
public class Row
{
private Dictionary<string, object> _data = new Dictionary<string, object>();
public object this[string index]
{
get { return _data[index]; }
set { _data[index] = value; }
}
}
我已将其添加到 Observable 集合中,例如
ObservableCollection<Row> RowList = new ObservableCollection<Row>();
在我的最终输出中,我得到
RowList[0]._data[0].Key = "Column 1"
.Value = "23"
._data[1].Key = "Column 2"
.Value = "Not Important"
._data[1].Key = "Column 3"
.Value = "Not Important"
RowList[1]._data[0].Key = "Column 1"
.Value = "11"
._data[1].Key = "Column 2"
.Value = "Not Important"
._data[1].Key = "Column 3"
.Value="Not Important"
RowList[2]._data[0].Key = "Column 1"
.Value = "8"
._data[1].Key = "Column 2"
.Value = "Not Important"
._data[1].Key = "Column 3"
.Value = "Not Important"
现在我想对Column 1
值进行排序。我可以使用我尝试使用的 Linq
foreach (RowList _r in RowList.OrderBy(p => p.Column1))// I am not sure if this approach is right
{
}