-
-
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
OrderBy
and ThenBy
- Loading branch information
1 parent
a255443
commit c986c52
Showing
4 changed files
with
197 additions
and
38 deletions.
There are no files selected for viewing
27 changes: 27 additions & 0 deletions
27
Docs/SuperLinq.Docs/apidoc/SuperLinq.SuperEnumerable.OrderBy.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,27 @@ | ||
--- | ||
uid: SuperLinq.SuperEnumerable.OrderBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},SuperLinq.OrderByDirection) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to sort a sequence using `OrderBy` and `ThenBy`. | ||
[!code-csharp[](SuperLinq/OrderBy/OrderBy1.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.ThenBy``2(System.Linq.IOrderedEnumerable{``0},System.Func{``0,``1},SuperLinq.OrderByDirection) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to sort a sequence using `OrderBy` and `ThenBy`. | ||
[!code-csharp[](SuperLinq/OrderBy/OrderBy1.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.OrderBy``2(System.Collections.Generic.IEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IComparer{``1},SuperLinq.OrderByDirection) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to sort a sequence using `OrderBy` and `ThenBy`. | ||
[!code-csharp[](SuperLinq/OrderBy/OrderBy2.linq#L6-)] | ||
|
||
--- | ||
uid: SuperLinq.SuperEnumerable.ThenBy``2(System.Linq.IOrderedEnumerable{``0},System.Func{``0,``1},System.Collections.Generic.IComparer{``1},SuperLinq.OrderByDirection) | ||
example: [*content] | ||
--- | ||
The following code example demonstrates how to sort a sequence using `OrderBy` and `ThenBy`. | ||
[!code-csharp[](SuperLinq/OrderBy/OrderBy2.linq#L6-)] |
24 changes: 24 additions & 0 deletions
24
Docs/SuperLinq.Docs/apidoc/SuperLinq/OrderBy/OrderBy1.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,24 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var fruits = new[] | ||
{ | ||
"grape", "passionfruit", "banana", "Mango", | ||
"Orange", "raspberry", "apple", "blueberry", | ||
}; | ||
|
||
// Sort the strings first by their length and then | ||
// alphabetically by passing the identity selector function. | ||
var result = fruits | ||
.OrderBy(fruit => fruit.Length) | ||
.ThenBy(fruit => fruit); | ||
|
||
Console.WriteLine( | ||
"[" + | ||
string.Join(", ", result) + | ||
"]"); | ||
|
||
// This code produces the following output: | ||
// [apple, grape, Mango, banana, Orange, blueberry, raspberry, passionfruit] |
24 changes: 24 additions & 0 deletions
24
Docs/SuperLinq.Docs/apidoc/SuperLinq/OrderBy/OrderBy2.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,24 @@ | ||
<Query Kind="Statements"> | ||
<NuGetReference>SuperLinq</NuGetReference> | ||
<Namespace>SuperLinq</Namespace> | ||
</Query> | ||
|
||
var fruits = new[] | ||
{ | ||
"grape", "passionfruit", "banana", "Mango", | ||
"Orange", "raspberry", "apple", "blueberry", | ||
}; | ||
|
||
// Sort the strings first by their length and then | ||
// alphabetically by passing the identity selector function. | ||
var result = fruits | ||
.OrderBy(fruit => fruit.Length) | ||
.ThenBy(fruit => fruit, StringComparer.Ordinal); | ||
|
||
Console.WriteLine( | ||
"[" + | ||
string.Join(", ", result) + | ||
"]"); | ||
|
||
// This code produces the following output: | ||
// [Mango, apple, grape, Orange, banana, blueberry, raspberry, passionfruit] |
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