Using Concat to merge two integer arrays into a single sequence : Concat « LINQ « C# / CSharp Tutorial






using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        int[] numbersA = { 0, 2, 4, 5, 6, 8, 9 };
        int[] numbersB = { 1, 3, 5, 7, 8 };

        var allNumbers = numbersA.Concat(numbersB);

        Console.WriteLine("All numbers from both arrays:");
        foreach (var n in allNumbers) {
            Console.WriteLine(n);
        }
    }
}








22.27.Concat
22.27.1.Using Concat with array elements
22.27.2.Using Concat to merge two integer arrays into a single sequence
22.27.3.Using Concat to merge the names of all customers and products
22.27.4.Concat Prototype
22.27.5.Concatention by Using the Concat Operator
22.27.6.Concat appends one sequence to another
22.27.7.Concatenate one array to another