List<List<string>> list = new List<List<string>>() { new List<string>(){"1","2","3"}, new List<string>(){"2","1","3"}, new List<string>(){"1","5","5"}, new List<string>(){"5","1","5"}, new List<string>(){"1","1","5"}, }; var query = from l in list.Select(t => t.OrderBy(m => m).ToList()).ToList() group l by new { L1 = l[0], L2 = l[1], L3 = l[2] } into g select g; 在VS里敲了一遍,手写的不对
List<List<string>> list = new List<List<string>>() { new List<string>(){"1","2","3"}, new List<string>(){"2","1","3"}, new List<string>(){"1","5","5"}, new List<string>(){"5","1","5"}, new List<string>(){"1","1","5"}, }; var counts = list.Select(t => t.OrderBy(m => m).ToList()).GroupBy((l) => new { L1 = l[0], L2 = l[1], L3 = l[2] }) .Select(g => new { Key = g.Key, Count = g.Count() });你再要就没有了
{
new List<string>(){"1","2","3"},
new List<string>(){"2","1","3"},
new List<string>(){"1","5","5"},
new List<string>(){"5","1","5"},
new List<string>(){"1","1","5"},
};
var query = from l in list.Select(t => t.OrderBy(m => m).ToList()).ToList()
group l by new { L1 = l[0], L2 = l[1], L3 = l[2] } into g
select g;
在VS里敲了一遍,手写的不对
{
new List<string>(){"1","2","3"},
new List<string>(){"2","1","3"},
new List<string>(){"1","5","5"},
new List<string>(){"5","1","5"},
new List<string>(){"1","1","5"},
}; var counts = list.Select(t => t.OrderBy(m => m).ToList()).GroupBy((l) => new { L1 = l[0], L2 = l[1], L3 = l[2] })
.Select(g => new { Key = g.Key, Count = g.Count() });你再要就没有了