Logo

Programming-Idioms

This language bar is your friend. Select your favorite languages!
  • C#

Idiom #166 Concatenate two lists

Create the list ab containing all the elements of the list a, followed by all the elements of the list b.

System.Linq
var list1 = new List<int>(){1,2,3};
var list2 = new List<int>(){4,5,6};

var list3 = list1.Concat(list2);

This returns new array.
Use AddRange() to add items to the same array
(def ab (concat a b))

New implementation...