小编Jas*_*hel的帖子

在List <Object>中合并两个属性上的对象

public class Note
{
    public string account;
    public DateTime noteDate;
    public string noteText;
}

List<Note> List1;
Run Code Online (Sandbox Code Playgroud)

使用LINQ我正在寻找一种方法来组合noteText何处accountnoteDate相同.例如,如果传入列表有三个对象:

List1[0] = "1234", 2017-10-03, "This is a"
List1[1] = "1234", 2017-10-03, " sample note."
List1[2] = "4321", 2017-10-03, "This is another note."
Run Code Online (Sandbox Code Playgroud)

我希望新列表有两个对象:

List2[0] = "1234", 2017-10-03, "This is a sample note."
List2[1] = "4321", 2017-10-03, "This is another note."
Run Code Online (Sandbox Code Playgroud)

c# linq

0
推荐指数
1
解决办法
50
查看次数

标签 统计

c# ×1

linq ×1