Joining of arrays

Posted by Ddd under LINQ category on | Points: 40 | Views : 1681
//This code will join the arrays on the basis of the common values

using System;
using System.Linq;

class arrayjoin
static void Main()
int[] arr={10,20,30};
int[] arr1={20,30,40};

var q=from p in arr join r in arr1 on p equals r select new {p,r};
Console.WriteLine("the join is");
foreach(var z in q)

//The output :

// The join is
// {p=20,r=20}
// {p=30,r=30}

Comments or Responses

Login to post response