Concat C# with Example



Concat C# with Example

Merges two collections (without removing duplicates) 
List foo = new List { 1, 2, 3 }; 
List bar = new List { 3, 4, 5 }; 
// Through Enumerable static class 
var result = Enumerable.Concat(foo, bar).ToList(); // 1,2,3,3,4,5 
// Through extension method 
var result = foo.Concat(bar).ToList(); // 1,2,3,3,4,5 

0 Comment's

Comment Form

Submit Comment