Add two lists in C#

Add two lists / Combine lists in C#


var result = list1.Concat(list2);
ListaddedList = result.ToList();


Here you go wit an example

List list1 = new List();
list1.Add("One");
list1.Add("Two");

List list2 = new List();
list2.Add("three");
list2.Add("four");

var result = list1.Concat(list2);
List addedList = result.ToList();
(Now addedList = list1 + list2 )

No comments:

Post a Comment

Keep ur coding aside.. Relax for some time..