Constructor
new LinqOrder(iterable, keySelector, comparer, desc, thisArg)
- Description:
- Initializes a new instance of LinqOrder used for sorting operations.
Returned by `orderBy()` or `orderByDescending()`.
- Source:
Parameters:
Name |
Type |
Description |
iterable |
Iterable.<any>
|
The iterable to be wrapped. |
keySelector |
function
|
null
|
Function to extract key from each item (optional). |
comparer |
function
|
null
|
Function to compare keys (optional). |
desc |
boolean
|
If `true`, applies descending order. |
thisArg |
any
|
The context (`this`) for user-defined callbacks. |
Throws:
-
If `keySelector` or `comparer` is invalid.
-
-
Type
-
Error
Methods
thenBy(keySelectoropt, compareropt) → {Linq}
- Description:
- Performs a subsequent ordering of the elements in this sequence in ascending order, optionally by using the specified keySelector and comparer.
A call to orderBy/orderByDescending must be made before changing other calls to thenBy/thenByDescending.
This method performs a stable sort; that is, if the keys of two elements are equal, the order of the elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the same key.
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
keySelector |
function
|
<optional>
|
An optional function to extract a key from an element. By default the element is used as the key. |
comparer |
function
|
<optional>
|
An optional comparer to compare keys. By default a simple comparison is made. |
Throws:
-
A call to orderBy/orderByDescending must come before calling to thenBy/thenByDescending.
-
keySelector must be a function or nullish
-
comparer must be a function or nullish
Returns:
The elements of the sequence in ascending subsequent order, optionally by using the specified keySelector and comparer.
-
Type
-
Linq
thenByDescending(keySelectoropt, compareropt) → {Linq}
- Description:
- Performs a subsequent ordering of the elements in this sequence in descending order, optionally by using the specified keySelector and comparer.
A call to orderBy/orderByDescending must be made before changing other calls to thenBy/thenByDescending.
This method performs a stable sort; that is, if the keys of two elements are equal, the order of the elements is preserved. In contrast, an unstable sort does not preserve the order of elements that have the same key.
- Source:
Parameters:
Name |
Type |
Attributes |
Description |
keySelector |
function
|
<optional>
|
An optional function to extract a key from an element. Ny default the element is used as the key. |
comparer |
function
|
<optional>
|
An optional comparer to compare keys. By default a simple comparison is made. |
Throws:
-
-
A call to orderBy/orderByDescending must come before calling to thenBy/thenByDescending.
-
-
Type
-
Error
-
-
keySelector must be a function or nullish
-
-
Type
-
Error
-
-
comparer must be a function or nullish
-
-
Type
-
Error
Returns:
The elements of the sequence in descending subsequent order, optionally by using the specified keySelector and comparer.
-
Type
-
Linq