LINQ Concat() Method (C#.net):
The following code shows you how to concatenate two arrays. We can do this using loop and concatenate both array indexes simultaneously. But through LINQ Concat() method we don’t need loop. See the code below.
The following code shows you how to concatenate two arrays. We can do this using loop and concatenate both array indexes simultaneously. But through LINQ Concat() method we don’t need loop. See the code below.
int[] arr1 = { 2, 1, 2, 3, 7, 5, 10, 9 };
int[] arr2 = { 3, 5, 7, 2, 7, 5, 11, 19 };
var query = arr1.Concat(arr2);
foreach (var item in query)
Console.Write(item + " ");
2 1 2 3 7 5 10 3 5 7 2 7 5 11 19
Related Articles:
0 comments:
Post a Comment