Concatenate Data Sources - CSharp LINQ

CSharp examples for LINQ:IEnumerable

Description

Concatenate Data Sources

Demo Code


using System;/*from  w  w w. jav a 2s. c om*/
using System.Collections.Generic;
using System.Linq;
using System.Text;

class MainClass
    {
        static void Main(string[] args)
        {
            // create the data sources
            string[] datasource1 = { "Oracle", "MySQL", "PLSQL", "pear" };
            string[] datasource2 = { "A", "B", "C" };

            // perform the linq query
            IEnumerable<string> result = from e in datasource1.Concat<string>(datasource2)
                select e;

            // print the results
            foreach (string element in result)
            {
                Console.WriteLine(element);
            }
        }
    }

Result


Related Tutorials