Merge Two or more list according to order

c#

Solution

You're looking for `Zip` method:

var CompleteInformation = Name.Zip(Address, (n, a) => new { Address = a, Name = n }).ToList();

Gives you list of anonymous type instances, with two properties: `Address` i `Name`.

Update

You can call `Zip` more then once:

var CompleteInformation
    = Name.Zip(Address, (n, a) => new { Address = a, Name = n })
          .Zip(AnotherList, (x, s) => new { x.Address, x.Name, Another = s })
          .ToList();

Problem

I have two Lists ``` List<string> Name = new List<string>(); List<string> Address = new List<string>(); ``` Both the lists having 30 data. I want to merge both the lists to get a complete Information lists like ``` List<string, string> CompleteInformation = new List<string, string>(); ``` Also if I want to merge more than two list in one how it can be done.

Original source