Thursday, March 9, 2017

.NET: Combining two generic lists

 

Problem:

I had created two List collections based on a some predicate searches against an EF model.
I need to blend the 2 lists together


Solution:

The AddRange method did the trick
List<Type> list1;
List<Type> list2;

List<Type> combined;
combined.AddRange(list1);
combined.AddRange(list2);

Source:

http://stackoverflow.com/questions/2002770/net-combining-two-generic-lists


No comments:

Post a Comment