-
-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update documentation for
GroupAdjacent
- Loading branch information
1 parent
5333d6e
commit ceabc3d
Showing
8 changed files
with
440 additions
and
148 deletions.
There are no files selected for viewing
41 changes: 41 additions & 0 deletions
41
Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.GroupAdjacent.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent1.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IEqualityComparer{``1}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent2.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Func{``0,``2}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent3.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Func{``0,``2},System.Collections.Generic.IEqualityComparer{``1}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent4.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Func{``1,System.Collections.Generic.IEnumerable{``0},``2}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent5.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.GroupAdjacent``3(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Func{``1,System.Collections.Generic.IEnumerable{``0},``2},System.Collections.Generic.IEqualityComparer{``1}) | ||
example: [*content] | ||
--- | ||
The following code example shows how to group adjacent items in a sequence using `GroupAdjacent`: | ||
[!code-csharp[](SuperLinq/GroupAdjacent/GroupAdjacent6.linq#L6-)] |
35 changes: 35 additions & 0 deletions
35
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent1.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 789), | ||
(key: 2, value: 987), | ||
(key: 2, value: 654), | ||
(key: 2, value: 321), | ||
(key: 3, value: 789), | ||
(key: 3, value: 456), | ||
(key: 3, value: 123), | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result.Select(c => "[" + string.Join(", ", c) + "]")) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ [(1, 123), (1, 456), (1, 789)], [(2, 987), (2, 654), (2, 321)], [(3, 789), (3, 456), (3, 123)], [(1, 123), (1, 456), (1, 781)] ] |
36 changes: 36 additions & 0 deletions
36
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent2.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 789), | ||
(key: "feb", value: 987), | ||
(key: "Feb", value: 654), | ||
(key: "FEB", value: 321), | ||
(key: "mar", value: 789), | ||
(key: "Mar", value: 456), | ||
(key: "MAR", value: 123), | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key, | ||
StringComparer.OrdinalIgnoreCase); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result.Select(c => "[" + string.Join(", ", c) + "]")) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ [(jan, 123), (Jan, 456), (JAN, 789)], [(feb, 987), (Feb, 654), (FEB, 321)], [(mar, 789), (Mar, 456), (MAR, 123)], [(jan, 123), (Jan, 456), (JAN, 781)] ] |
36 changes: 36 additions & 0 deletions
36
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent3.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 789), | ||
(key: 2, value: 987), | ||
(key: 2, value: 654), | ||
(key: 2, value: 321), | ||
(key: 3, value: 789), | ||
(key: 3, value: 456), | ||
(key: 3, value: 123), | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key, | ||
x => x.value); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result.Select(c => "[" + string.Join(", ", c) + "]")) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ [(1, 123), (1, 456), (1, 789)], [(2, 987), (2, 654), (2, 321)], [(3, 789), (3, 456), (3, 123)], [(1, 123), (1, 456), (1, 781)] ] |
37 changes: 37 additions & 0 deletions
37
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent4.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 789), | ||
(key: "feb", value: 987), | ||
(key: "Feb", value: 654), | ||
(key: "FEB", value: 321), | ||
(key: "mar", value: 789), | ||
(key: "Mar", value: 456), | ||
(key: "MAR", value: 123), | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key, | ||
x => x.value, | ||
StringComparer.OrdinalIgnoreCase); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result.Select(c => "[" + string.Join(", ", c) + "]")) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ [123, 456, 789], [987, 654, 321], [789, 456, 123], [123, 456, 781] ] |
36 changes: 36 additions & 0 deletions
36
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent5.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 789), | ||
(key: 2, value: 987), | ||
(key: 2, value: 654), | ||
(key: 2, value: 321), | ||
(key: 3, value: 789), | ||
(key: 3, value: 456), | ||
(key: 3, value: 123), | ||
(key: 1, value: 123), | ||
(key: 1, value: 456), | ||
(key: 1, value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key, | ||
(k, g) => new { Key = k, Items = "[" + string.Join(", ", g.Select(x => x.value)) + "]", }); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ { Key = 1, Items = [123, 456, 789] }, { Key = 2, Items = [987, 654, 321] }, { Key = 3, Items = [789, 456, 123] }, { Key = 1, Items = [123, 456, 781] } ] |
37 changes: 37 additions & 0 deletions
37
Docs/SuperLinq.Docs/apidoc/SuperLinq/GroupAdjacent/GroupAdjacent6.linq
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = new[] | ||
{ | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 789), | ||
(key: "feb", value: 987), | ||
(key: "Feb", value: 654), | ||
(key: "FEB", value: 321), | ||
(key: "mar", value: 789), | ||
(key: "Mar", value: 456), | ||
(key: "MAR", value: 123), | ||
(key: "jan", value: 123), | ||
(key: "Jan", value: 456), | ||
(key: "JAN", value: 781), | ||
}; | ||
|
||
// Group adjacent items | ||
var result = sequence | ||
.GroupAdjacent( | ||
x => x.key, | ||
(k, g) => new { Key = k, Items = "[" + string.Join(", ", g.Select(x => x.value)) + "]", }, | ||
StringComparer.OrdinalIgnoreCase); | ||
|
||
Console.WriteLine( | ||
"[ " + | ||
string.Join( | ||
", ", | ||
result) + | ||
" ]"); | ||
|
||
// This code produces the following output: | ||
// [ { Key = jan, Items = [123, 456, 789] }, { Key = feb, Items = [987, 654, 321] }, { Key = mar, Items = [789, 456, 123] }, { Key = jan, Items = [123, 456, 781] } ] |
Oops, something went wrong.