Union does appends one sequence to another with duplicates removed: : Union « LINQ « C# / C Sharp






Union does appends one sequence to another with duplicates removed:

 

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 Linq to union two arrays
2.prints the unique elements of two integer arrays
3.prints unique letters from Product and Customer names
4.Union Operator