Concat appends one sequence to another : Concat « LINQ « C# / C Sharp






Concat appends one sequence to another

 


using System;
using System.Collections.Generic;
using System.Linq;
public class MainClass {
    public static void Main() {

        int[] seq1 = { 1, 2, 3 };
        int[] seq2 = { 3, 4, 5 };
        IEnumerable<int> concat = seq1.Concat(seq2);    //  { 1, 2, 3, 3, 4, 5 }
        IEnumerable<int> union = seq1.Union(seq2);     //  { 1, 2, 3, 4, 5 }
    }
}

 








Related examples in the same category

1.use Concat with array elements
2.Use Concat to merge two integer arrays into a single sequence
3.Uses Concat to merge the names of all customers and products
4.Concat Prototype
5.Concatention by Using the Concat Operator