How to

join two lists

Published: 9. October 2011 | Updated: 9. October 2011
License: Microsoft Public License (MS-PL)
Categories: Collections
Tags: C# Collections
Was this snippet helpful for you? YESYES / NONO

Import namespaces

using System.Collections.Generic;
using System.Linq;

Code

var list1 = new List<int>(new[] { 1, 2, 3, 4, 5 });
var list2 = new List<int>(new[] { 6, 7, 8, 9, 10 });

var merged = list1.Concat(list2);
Send us feedback about this snippet »



Related Snippets: