如果我有以下收藏:
var foos = new List<Foo>
{
new Foo{ Name = "A", Value = 1 },
new Foo{ Name = "B", Value = 1 },
new Foo{ Name = "B", Value = 2 },
new Foo{ Name = "C", Value = 1 },
};
我想结束:
A-1
B-2
C-1
在重复“B”的情况下,我想在哪里选择具有最高值的“B”?
就像是:
var filteredFoos = foos.GroupBy(x => x.Name).Select_Duplicate_With_Highest_Value