我有一个类项目
public class Project
{ public int ProjectId { get; set; }
public string ProjectName { get; set; }
public string Customer { get; set; }
public string Address{ get; set; }
}
我有 3 个列表
List<Project> lst1; List<Project> lst2; List<Project> lst3;
lst1
包含Person
具有 ProjectId 和 ProjectName 的对象。
ProjectId =1, ProjectName = "X", Customer = null, Address = null
ProjectId =2, ProjectName = "Y", Customer = null, Address = null
lst2
包含Person
具有 ProjectId 和 Customer 的对象
ProjectId =1,ProjectName = null, Customer = "c1", Address = null
ProjectId =2,ProjectName = null, Customer = "c2", Address = null
, 和
lst3
包含Person
具有 ProjectId 和 Address 的对象
ProjectId = 1, ProjectName = null, Customer =null, Address = "a1"
ProjectId = 2, ProjectName = null, Customer =null, Address = "a2"
.
考虑到每个列表中有多个这样的记录,并且 ProjectId 对于每个项目都是唯一的,我如何合并/组合这些列表以获得一个包含合并对象的列表
ProjectId=1, ProjectName="X", Customer="c1", address="a1"
ProjectId=2, ProjectName="Y", Customer="c2", address="a2"
我发现这些链接相似并尝试使用它但无法满足结果
谢谢你。