-
-
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.
- Loading branch information
1 parent
fa62fd2
commit eda144b
Showing
4 changed files
with
121 additions
and
44 deletions.
There are no files selected for viewing
13 changes: 13 additions & 0 deletions
13
Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.Subsets.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,13 @@ | ||
--- | ||
uid: SuperLinq.SuperEnumerable.Subsets``1(System.Collections.Generic.IEnumerable{``0}) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to get all subsets of a sequence using `Subsets`. | ||
[!code-csharp[](SuperLinq/Subsets/Subsets1.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.Subsets``1(System.Collections.Generic.IEnumerable{``0},System.Int32) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how get all subsets of a particular length using `Subsets`. | ||
[!code-csharp[](SuperLinq/Subsets/Subsets2.linq#L6-)] |
37 changes: 37 additions & 0 deletions
37
Docs/SuperLinq.Docs/apidoc/SuperLinq/Subsets/Subsets1.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 = Enumerable.Range(0, 4); | ||
|
||
// check that sequence starts with a known sequence of values | ||
var result = sequence | ||
.Subsets(); | ||
|
||
Console.WriteLine( | ||
"[" + Environment.NewLine + | ||
string.Join( | ||
", " + Environment.NewLine, | ||
result.Select(c => " [" + string.Join(", ", c) + "]")) + | ||
Environment.NewLine + "]"); | ||
|
||
// This code produces the following output: | ||
// [ | ||
// [], | ||
// [0], | ||
// [1], | ||
// [2], | ||
// [3], | ||
// [0, 1], | ||
// [0, 2], | ||
// [0, 3], | ||
// [1, 2], | ||
// [1, 3], | ||
// [2, 3], | ||
// [0, 1, 2], | ||
// [0, 1, 3], | ||
// [0, 2, 3], | ||
// [1, 2, 3], | ||
// [0, 1, 2, 3] | ||
// ] |
27 changes: 27 additions & 0 deletions
27
Docs/SuperLinq.Docs/apidoc/SuperLinq/Subsets/Subsets2.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,27 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var sequence = Enumerable.Range(0, 4); | ||
|
||
// check that sequence starts with a known sequence of values | ||
var result = sequence | ||
.Subsets(2); | ||
|
||
Console.WriteLine( | ||
"[" + Environment.NewLine + | ||
string.Join( | ||
", " + Environment.NewLine, | ||
result.Select(c => " [" + string.Join(", ", c) + "]")) + | ||
Environment.NewLine + "]"); | ||
|
||
// This code produces the following output: | ||
// [ | ||
// [0, 1], | ||
// [0, 2], | ||
// [0, 3], | ||
// [1, 2], | ||
// [1, 3], | ||
// [2, 3] | ||
// ] |
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