我有一个项目清单
我想把它们推回到这样的列表中,这也意味着我想按重复数量最多的方式排序.
让我知道如何使用LINQ和C#来做到这一点.
谢谢大家
编辑2显示代码:
List<game> inventory = new List<game>();
drinkingforDataContext db = new drinkingforDataContext();
foreach (string item in tbTitle.Text.Split(' '))
{
List<game> getItems = (from dfg in db.drinkingfor_Games
where dfg.game_Name.Contains(tbTitle.Text)
select new game
{
gameName = dfg.game_Name,
gameID = Boomers.Utilities.Guids.Encoder.EncodeURLs(dfg.uid)
}).ToList<game>();
for (int i = 0; i < getItems.Count(); i++)
{
inventory.Add(getItems[i]);
}
}
var items = (from xx in inventory
group xx by …Run Code Online (Sandbox Code Playgroud) 说我有这个数组:MyArray(0)="aaa"MyArray(1)="bbb"MyArray(2)="aaa"
是否有.net功能可以给我独特的价值?我希望这样的东西作为函数的输出:OutputArray(0)="aaa"OutputArray(1)="bbb"
我刚刚开始学习linq和lambda表达式,它们似乎非常适合在复杂的对象集合中查找重复项,但我有点困惑,希望有人可以帮助我回到快乐编码的道路上.
我的对象的结构类似于list.list.uniqueCustomerIdentifier
我需要确保整个复杂对象中没有重复的uniqueCustomerIdentifier.如果有重复项,我需要确定哪些是重复的并返回重复项列表.