.NET Framework Class Library |
ParallelEnumerable..::.AsOrdered Method (ParallelQuery) |
ParallelEnumerable Class See Also Send Feedback |
Enables treatment of a data source as if it was ordered, overriding the default of unordered.
AsOrdered may only be invoked on sequences returned by AsParallel, ParallelEnumerable.Range,
and ParallelEnumerable.Repeat.
Namespace:
System.Linq
Assembly:
System.Threading (in System.Threading.dll)
Syntax
Visual Basic (Declaration) |
---|
Public Shared Function AsOrdered ( _ source As ParallelQuery _ ) As ParallelQuery |
C# |
---|
public static ParallelQuery AsOrdered( ParallelQuery source ) |
Parameters
- source
- Type: System.Linq..::.ParallelQuery
The input sequence.
Return Value
The source sequence which will maintain ordering in the query.Remarks
A natural tension exists between performance and preserving order in parallel processing. By default,
a parallelized query behaves as if the ordering of the results is arbitrary unless AsOrdered
is applied or there is an explicit OrderBy operator in the query.
Exceptions
Exception | Condition |
---|---|
System..::.InvalidOperationException | Thrown if the source is not one of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat. |
System..::.ArgumentNullException | source is a null reference (Nothing in Visual Basic). |