Let’s say I have
var list1 = new List<string>();
var list2 = new List<string>();
I’d like to merge content of both list. Is looping over one of the list to extract and add content to the second list the only way to merge content?
foreach(var name in list2)
{
list1.add(name);
}
Is there a different way of merging content?
Thanks for helping
Just use
AddRange.This example will take the items in
list2and add them tolist1