Search This Blog

Thursday, April 7, 2011

Join two lists using LINQ

static void Main(string[] args)
// Create an instance
MyEntitiesDataContext myEntitiesDataContext = new MyEntitiesDataContext("http://servername:2010/sites/test/");
// Get the lists from the site
EntityList aList = myEntitiesDataContext.GetList("A");
EntityList bList = myEntitiesDataContext.GetList("B");

List aListItems=(from a in aList select a).ToList();
List bListItems = (from b in bList select b).ToList();

IEnumerable mergedList = aListItems.Union(bListItems);

foreach (Item items in mergedList)

No comments:

Post a Comment