我想在.NET 3.5中做这样的事情。什么是最快捷的方式?
IEnumerable<DataRow[]> list =
(from r in datarow.AsEnumerable()
group r by r[CoumnName]).
SelectMany(g => g.OrderBy(r => r[CoumnName]));
Datarow[] resultDatarow = list.Cast<Datarow[]>;
怎么做?
答案 0 :(得分:2)
也许您可以使用ToArray
而不使用SelectMany
:
IEnumerable<DataRow[]> list = (from r in datarow.AsEnumerable()
group r by r[CoumnName]).
Select(g => g.OrderBy(r => r[CoumnName]).ToArray());
Datarow[][] resultDatarow = list.ToArray();