Wriju's BLOG

.NET, Cloud and everything

LINQ A Journey through Operators [Concat]

 


Imagine you have two arrays and you need to join them. Using LINQ it is as simple as mentioned


 


using System;


using System.Collections.Generic;


using System.Text;


using System.Query;


using System.Xml.XLinq;


using System.Data.DLinq;


 


namespace LINQ_Concat


{


    class Program


    {


        static void Main(string[] args)


        {


 


            char[] alpha1 = {‘A’,‘B’,‘C’,‘D’,‘E’,‘F’,‘G’,‘H’,‘I’};


            char[] alpha2 = {‘J’,‘K’,‘L’,‘M’,‘N’,‘O’,‘P’,‘Q’,‘R’};


 


            var alphaAll = alpha1.Concat(alpha2);


 


            foreach(var al in alphaAll)


            {


                Console.WriteLine(al);


            }


            Console.ReadKey();


        }


    }


}


 


Output will look like


 







A


B


C


D


E


F


G


H


I


J


K


L


M


N


O


P


Q


R


 


Namoskar