Merge lists into one

后端 未结 4 522
我寻月下人不归
我寻月下人不归 2021-01-28 10:57

I saw posts like below which are really hard for me to understand. So I am re-posting it. Sorry if someone feels it\'s duplicate. I have just simple requirements

C# Join

4条回答
  •  遥遥无期
    2021-01-28 11:35

    You can solve it with Enumerable.Zip and Ordering the Data before:

    IEnumerable list = GetNames(new List()).OrderBy(p => p.Id).Zip(GetMainlingAddress(new List()).OrderBy(p => p.Id), (first, second) => { return new Person() { Id = first.Id, Name = first.Name, MailingAddress = second.MailingAddress }; });
    

提交回复
热议问题