38
1
using System;
2
using System.Linq;
3
using System.Collections.Generic;
4
5
6
public class Program
7
{
8
public static void Main()
9
{
10
// Student collection
11
IList<string> strList1 = new List<string>() {
12
"One",
13
"Two",
14
"Three",
15
"Four"
16
};
17
18
IList<string> strList2 = new List<string>() {
19
"One",
20
"Two",
21
"Five",
22
"Six"
23
};
24
25
var innerJoinResult = strList1.Join(// outer sequence
26
strList2, // inner sequence
27
str1 => str1, // outerKeySelector
28
str2 => str2, // innerKeySelector
29
(str1, str2) => str1);
30
31
foreach (var str in innerJoinResult)
32
{
33
Console.WriteLine("{0} ", str);
34
}
35
36
}
37
}
38
Cached Result
Bob - 123
Bob - 456
James - 789
James - 10112
Ram - 222
Ram - 3333
Bob - 456
James - 789
James - 10112
Ram - 222
Ram - 3333