Click here to Skip to main content
14,241,676 members
Rate this:
Please Sign up or sign in to vote.
See more:
I need to combine the 2 lists into a new List using LINQ
Posted
Rate this:
Please Sign up or sign in to vote.

Solution 1

Try
var result = from item1 A item in first
                    from item1 B in second
                    select new{ A, B};
   
Rate this:
Please Sign up or sign in to vote.

Solution 2

To add to Abinav's solution, not using Linq:
List<myClass> newList = new List<myClass>();
newList.AddRange(oldListA);
newList.AddRange(oldListB);
This has the advantage of being typesafe.
   

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100