Simple Join : Join « LINQ « C# / CSharp Tutorial






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


public class MainClass{

   public static void Main(string[] args){   
            Int32[] ArrayA = { 1, 2, 3, 4, 8 };
            Int32[] ArrayB = { 1, 3, 5, 7, 8 };

            var Joined = from QueryA in ArrayA
                         join QueryB in ArrayB
                         on QueryA equals QueryB
                         select new { QueryA, QueryB };


            foreach (var OutPair in Joined)
                Console.WriteLine(OutPair.QueryA.ToString() + " - " + OutPair.QueryB.ToString());


   }
}








22.8.Join
22.8.1.Join two object lists
22.8.2.Use join key word
22.8.3.Join three object list
22.8.4.Use Join on
22.8.5.Join Operator
22.8.6.Cartesian Join demo
22.8.7.Use == in join
22.8.8.Simple Join
22.8.9.OrderBy joined value
22.8.10.Join on substring