Skip to content

Commit d8fd221

Browse files
Add linqpad samples for new XxxJoin methods (#632)
1 parent acc01e1 commit d8fd221

24 files changed

+1083
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
uid: SuperLinq.SuperEnumerable.FullOuterHashJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
3+
example: [*content]
4+
---
5+
The following code example demonstrates how to execute an full outer hash join of two sequences using `FullOuterHashJoin`.
6+
[!code-csharp[](SuperLinq/FullOuterHashJoin/FullOuterHashJoin1.linq#L6-)]
7+
8+
---
9+
uid: SuperLinq.SuperEnumerable.FullOuterHashJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``3},System.Func{``1,``3},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
10+
example: [*content]
11+
---
12+
The following code example demonstrates how to execute an full outer hash join of two sequences using `FullOuterHashJoin`.
13+
[!code-csharp[](SuperLinq/FullOuterHashJoin/FullOuterHashJoin2.linq#L6-)]
14+
15+
---
16+
uid: SuperLinq.SuperEnumerable.FullOuterMergeJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IComparer{``2})
17+
example: [*content]
18+
---
19+
The following code example demonstrates how to execute an full outer merge join of two sequences using `FullOuterMergeJoin`.
20+
[!code-csharp[](SuperLinq/FullOuterMergeJoin/FullOuterMergeJoin1.linq#L6-)]
21+
22+
---
23+
uid: SuperLinq.SuperEnumerable.FullOuterMergeJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``3},System.Func{``1,``3},System.Func{``0,``1,``3},System.Collections.Generic.IComparer{``2})
24+
example: [*content]
25+
---
26+
The following code example demonstrates how to execute an full outer merge join of two sequences using `FullOuterMergeJoin`.
27+
[!code-csharp[](SuperLinq/FullOuterMergeJoin/FullOuterMergeJoin2.linq#L6-)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
uid: SuperLinq.SuperEnumerable.InnerHashJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
3+
example: [*content]
4+
---
5+
The following code example demonstrates how to execute an inner hash join of two sequences using `InnerHashJoin`.
6+
[!code-csharp[](SuperLinq/InnerHashJoin/InnerHashJoin1.linq#L6-)]
7+
8+
---
9+
uid: SuperLinq.SuperEnumerable.InnerHashJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
10+
example: [*content]
11+
---
12+
The following code example demonstrates how to execute an inner hash join of two sequences using `InnerHashJoin`.
13+
[!code-csharp[](SuperLinq/InnerHashJoin/InnerHashJoin2.linq#L6-)]
14+
15+
---
16+
uid: SuperLinq.SuperEnumerable.InnerLoopJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
17+
example: [*content]
18+
---
19+
The following code example demonstrates how to execute an inner loop join of two sequences using `InnerLoopJoin`.
20+
[!code-csharp[](SuperLinq/InnerLoopJoin/InnerLoopJoin1.linq#L6-)]
21+
22+
---
23+
uid: SuperLinq.SuperEnumerable.InnerLoopJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
24+
example: [*content]
25+
---
26+
The following code example demonstrates how to execute an inner loop join of two sequences using `InnerLoopJoin`.
27+
[!code-csharp[](SuperLinq/InnerLoopJoin/InnerLoopJoin2.linq#L6-)]
28+
29+
---
30+
uid: SuperLinq.SuperEnumerable.InnerMergeJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IComparer{``2})
31+
example: [*content]
32+
---
33+
The following code example demonstrates how to execute an inner merge join of two sequences using `InnerMergeJoin`.
34+
[!code-csharp[](SuperLinq/InnerMergeJoin/InnerMergeJoin1.linq#L6-)]
35+
36+
---
37+
uid: SuperLinq.SuperEnumerable.InnerMergeJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``1,``3},System.Collections.Generic.IComparer{``2})
38+
example: [*content]
39+
---
40+
The following code example demonstrates how to execute an inner merge join of two sequences using `InnerMergeJoin`.
41+
[!code-csharp[](SuperLinq/InnerMergeJoin/InnerMergeJoin2.linq#L6-)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
---
2+
uid: SuperLinq.SuperEnumerable.LeftOuterHashJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
3+
example: [*content]
4+
---
5+
The following code example demonstrates how to execute an left outer hash join of two sequences using `LeftOuterHashJoin`.
6+
[!code-csharp[](SuperLinq/LeftOuterHashJoin/LeftOuterHashJoin1.linq#L6-)]
7+
8+
---
9+
uid: SuperLinq.SuperEnumerable.LeftOuterHashJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``3},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
10+
example: [*content]
11+
---
12+
The following code example demonstrates how to execute an left outer hash join of two sequences using `LeftOuterHashJoin`.
13+
[!code-csharp[](SuperLinq/LeftOuterHashJoin/LeftOuterHashJoin2.linq#L6-)]
14+
15+
---
16+
uid: SuperLinq.SuperEnumerable.LeftOuterLoopJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
17+
example: [*content]
18+
---
19+
The following code example demonstrates how to execute an left outer loop join of two sequences using `LeftOuterLoopJoin`.
20+
[!code-csharp[](SuperLinq/LeftOuterLoopJoin/LeftOuterLoopJoin1.linq#L6-)]
21+
22+
---
23+
uid: SuperLinq.SuperEnumerable.LeftOuterLoopJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``3},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
24+
example: [*content]
25+
---
26+
The following code example demonstrates how to execute an left outer loop join of two sequences using `LeftOuterLoopJoin`.
27+
[!code-csharp[](SuperLinq/LeftOuterLoopJoin/LeftOuterLoopJoin2.linq#L6-)]
28+
29+
---
30+
uid: SuperLinq.SuperEnumerable.LeftOuterMergeJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IComparer{``2})
31+
example: [*content]
32+
---
33+
The following code example demonstrates how to execute an left outer merge join of two sequences using `LeftOuterMergeJoin`.
34+
[!code-csharp[](SuperLinq/LeftOuterMergeJoin/LeftOuterMergeJoin1.linq#L6-)]
35+
36+
---
37+
uid: SuperLinq.SuperEnumerable.LeftOuterMergeJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``0,``3},System.Func{``0,``1,``3},System.Collections.Generic.IComparer{``2})
38+
example: [*content]
39+
---
40+
The following code example demonstrates how to execute an left outer merge join of two sequences using `LeftOuterMergeJoin`.
41+
[!code-csharp[](SuperLinq/LeftOuterMergeJoin/LeftOuterMergeJoin2.linq#L6-)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
---
2+
uid: SuperLinq.SuperEnumerable.RightOuterHashJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IEqualityComparer{``2})
3+
example: [*content]
4+
---
5+
The following code example demonstrates how to execute an right outer hash join of two sequences using `RightOuterHashJoin`.
6+
[!code-csharp[](SuperLinq/RightOuterHashJoin/RightOuterHashJoin1.linq#L6-)]
7+
8+
---
9+
uid: SuperLinq.SuperEnumerable.RightOuterHashJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``1,``3},System.Func{``0,``1,``3},System.Collections.Generic.IEqualityComparer{``2})
10+
example: [*content]
11+
---
12+
The following code example demonstrates how to execute an right outer hash join of two sequences using `RightOuterHashJoin`.
13+
[!code-csharp[](SuperLinq/RightOuterHashJoin/RightOuterHashJoin2.linq#L6-)]
14+
15+
---
16+
uid: SuperLinq.SuperEnumerable.RightOuterMergeJoin``3(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Collections.Generic.IComparer{``2})
17+
example: [*content]
18+
---
19+
The following code example demonstrates how to execute an right outer merge join of two sequences using `RightOuterMergeJoin`.
20+
[!code-csharp[](SuperLinq/RightOuterMergeJoin/RightOuterMergeJoin1.linq#L6-)]
21+
22+
---
23+
uid: SuperLinq.SuperEnumerable.RightOuterMergeJoin``4(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``1},System.Func{``0,``2},System.Func{``1,``2},System.Func{``1,``3},System.Func{``0,``1,``3},System.Collections.Generic.IComparer{``2})
24+
example: [*content]
25+
---
26+
The following code example demonstrates how to execute an right outer merge join of two sequences using `RightOuterMergeJoin`.
27+
[!code-csharp[](SuperLinq/RightOuterMergeJoin/RightOuterMergeJoin2.linq#L6-)]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Query Kind="Statements">
2+
<NuGetReference>SuperLinq</NuGetReference>
3+
<Namespace>SuperLinq</Namespace>
4+
</Query>
5+
6+
var people = new Person[]
7+
{
8+
new("John Doe", 1),
9+
new("Jane Doe", 6),
10+
new("Lucy Ricardo", 4),
11+
new("Ricky Ricardo", 2),
12+
new("Fred Mertz", 3),
13+
new("Ethel Mertz", 5),
14+
};
15+
16+
var pets = new Pet[]
17+
{
18+
new("Bear", 8),
19+
new("Polly", 2),
20+
new("Minnie", 2),
21+
new("Mittens", 1),
22+
new("Patches", 1),
23+
new("Paws", 1),
24+
};
25+
26+
var results = people
27+
.FullOuterHashJoin(
28+
pets,
29+
p => p.PersonId,
30+
p => p.PersonId);
31+
32+
foreach (var (person, pet) in results)
33+
{
34+
Console.WriteLine($"({person?.Name ?? "N/A"}, {pet?.Name ?? "No Pets"})");
35+
}
36+
37+
// This code produces the following output:
38+
// (John Doe, Mittens)
39+
// (John Doe, Patches)
40+
// (John Doe, Paws)
41+
// (Jane Doe, No Pets)
42+
// (Lucy Ricardo, No Pets)
43+
// (Ricky Ricardo, Polly)
44+
// (Ricky Ricardo, Minnie)
45+
// (Fred Mertz, No Pets)
46+
// (Ethel Mertz, No Pets)
47+
// (N/A, Bear)
48+
49+
record Person(string Name, int PersonId);
50+
record Pet(string Name, int PersonId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<Query Kind="Statements">
2+
<NuGetReference>SuperLinq</NuGetReference>
3+
<Namespace>SuperLinq</Namespace>
4+
</Query>
5+
6+
var people = new Person[]
7+
{
8+
new("John Doe", 1),
9+
new("Jane Doe", 6),
10+
new("Lucy Ricardo", 4),
11+
new("Ricky Ricardo", 2),
12+
new("Fred Mertz", 3),
13+
new("Ethel Mertz", 5),
14+
};
15+
16+
var pets = new Pet[]
17+
{
18+
new("Bear", 8),
19+
new("Polly", 2),
20+
new("Minnie", 2),
21+
new("Mittens", 1),
22+
new("Patches", 1),
23+
new("Paws", 1),
24+
};
25+
26+
var results = people
27+
.FullOuterHashJoin(
28+
pets,
29+
p => p.PersonId,
30+
p => p.PersonId,
31+
person => $"({person.Name}, No Pets)",
32+
pet => $"(N/A, {pet.Name})",
33+
(person, pet) => $"({person.Name}, {pet.Name})");
34+
35+
foreach (var str in results)
36+
Console.WriteLine(str);
37+
38+
// This code produces the following output:
39+
// (John Doe, Mittens)
40+
// (John Doe, Patches)
41+
// (John Doe, Paws)
42+
// (Jane Doe, No Pets)
43+
// (Lucy Ricardo, No Pets)
44+
// (Ricky Ricardo, Polly)
45+
// (Ricky Ricardo, Minnie)
46+
// (Fred Mertz, No Pets)
47+
// (Ethel Mertz, No Pets)
48+
// (N/A, Bear)
49+
50+
record Person(string Name, int PersonId);
51+
record Pet(string Name, int PersonId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
<Query Kind="Statements">
2+
<NuGetReference>SuperLinq</NuGetReference>
3+
<Namespace>SuperLinq</Namespace>
4+
</Query>
5+
6+
var people = new Person[]
7+
{
8+
new("John Doe", 1),
9+
new("Jane Doe", 6),
10+
new("Lucy Ricardo", 4),
11+
new("Ricky Ricardo", 2),
12+
new("Fred Mertz", 3),
13+
new("Ethel Mertz", 5),
14+
};
15+
16+
var pets = new Pet[]
17+
{
18+
new("Bear", 8),
19+
new("Polly", 2),
20+
new("Minnie", 2),
21+
new("Mittens", 1),
22+
new("Patches", 1),
23+
new("Paws", 1),
24+
};
25+
26+
var results = people.OrderBy(p => p.PersonId)
27+
.FullOuterMergeJoin(
28+
pets.OrderBy(p => p.PersonId),
29+
p => p.PersonId,
30+
p => p.PersonId);
31+
32+
foreach (var (person, pet) in results)
33+
{
34+
Console.WriteLine($"({person?.Name ?? "N/A"}, {pet?.Name ?? "No Pets"})");
35+
}
36+
37+
// This code produces the following output:
38+
// (John Doe, Mittens)
39+
// (John Doe, Patches)
40+
// (John Doe, Paws)
41+
// (Jane Doe, No Pets)
42+
// (Lucy Ricardo, No Pets)
43+
// (Ricky Ricardo, Polly)
44+
// (Ricky Ricardo, Minnie)
45+
// (Fred Mertz, No Pets)
46+
// (Ethel Mertz, No Pets)
47+
// (N/A, Bear)
48+
49+
record Person(string Name, int PersonId);
50+
record Pet(string Name, int PersonId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
<Query Kind="Statements">
2+
<NuGetReference>SuperLinq</NuGetReference>
3+
<Namespace>SuperLinq</Namespace>
4+
</Query>
5+
6+
var people = new Person[]
7+
{
8+
new("John Doe", 1),
9+
new("Jane Doe", 6),
10+
new("Lucy Ricardo", 4),
11+
new("Ricky Ricardo", 2),
12+
new("Fred Mertz", 3),
13+
new("Ethel Mertz", 5),
14+
};
15+
16+
var pets = new Pet[]
17+
{
18+
new("Bear", 8),
19+
new("Polly", 2),
20+
new("Minnie", 2),
21+
new("Mittens", 1),
22+
new("Patches", 1),
23+
new("Paws", 1),
24+
};
25+
26+
var results = people.OrderBy(p => p.PersonId)
27+
.FullOuterMergeJoin(
28+
pets.OrderBy(p => p.PersonId),
29+
p => p.PersonId,
30+
p => p.PersonId,
31+
person => $"({person.Name}, No Pets)",
32+
pet => $"(N/A, {pet.Name})",
33+
(person, pet) => $"({person.Name}, {pet.Name})");
34+
35+
foreach (var str in results)
36+
Console.WriteLine(str);
37+
38+
// This code produces the following output:
39+
// (John Doe, Mittens)
40+
// (John Doe, Patches)
41+
// (John Doe, Paws)
42+
// (Jane Doe, No Pets)
43+
// (Lucy Ricardo, No Pets)
44+
// (Ricky Ricardo, Polly)
45+
// (Ricky Ricardo, Minnie)
46+
// (Fred Mertz, No Pets)
47+
// (Ethel Mertz, No Pets)
48+
// (N/A, Bear)
49+
50+
record Person(string Name, int PersonId);
51+
record Pet(string Name, int PersonId);
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
<Query Kind="Statements">
2+
<NuGetReference>SuperLinq</NuGetReference>
3+
<Namespace>SuperLinq</Namespace>
4+
</Query>
5+
6+
var people = new Person[]
7+
{
8+
new("John Doe", 1),
9+
new("Jane Doe", 6),
10+
new("Lucy Ricardo", 4),
11+
new("Ricky Ricardo", 2),
12+
new("Fred Mertz", 3),
13+
new("Ethel Mertz", 5),
14+
};
15+
16+
var pets = new Pet[]
17+
{
18+
new("Bear", 8),
19+
new("Polly", 2),
20+
new("Minnie", 2),
21+
new("Mittens", 1),
22+
new("Patches", 1),
23+
new("Paws", 1),
24+
};
25+
26+
var results = people
27+
.InnerHashJoin(
28+
pets,
29+
p => p.PersonId,
30+
p => p.PersonId);
31+
32+
foreach (var (person, pet) in results)
33+
{
34+
Console.WriteLine($"({person.Name}, {pet.Name})");
35+
}
36+
37+
// This code produces the following output:
38+
// (John Doe, Mittens)
39+
// (John Doe, Patches)
40+
// (John Doe, Paws)
41+
// (Ricky Ricardo, Polly)
42+
// (Ricky Ricardo, Minnie)
43+
44+
record Person(string Name, int PersonId);
45+
record Pet(string Name, int PersonId);

0 commit comments

Comments
 (0)