Bewerken

Delen via


ParallelEnumerable.AsOrdered Method

Definition

Overloads

AsOrdered(ParallelQuery)

Enables treatment of a data source as if it were ordered, overriding the default of unordered. AsOrdered may only be invoked on non-generic sequences returned by AsParallel, ParallelEnumerable.Range, and ParallelEnumerable.Repeat.

AsOrdered<TSource>(ParallelQuery<TSource>)

Enables treatment of a data source as if it were ordered, overriding the default of unordered. AsOrdered may only be invoked on generic sequences returned by AsParallel, ParallelEnumerable.Range, and ParallelEnumerable.Repeat.

AsOrdered(ParallelQuery)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Enables treatment of a data source as if it were ordered, overriding the default of unordered. AsOrdered may only be invoked on non-generic sequences returned by AsParallel, ParallelEnumerable.Range, and ParallelEnumerable.Repeat.

public:
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery ^ AsOrdered(System::Linq::ParallelQuery ^ source);
public static System.Linq.ParallelQuery AsOrdered (this System.Linq.ParallelQuery source);
static member AsOrdered : System.Linq.ParallelQuery -> System.Linq.ParallelQuery
<Extension()>
Public Function AsOrdered (source As ParallelQuery) As ParallelQuery

Parameters

source
ParallelQuery

The input sequence.

Returns

The source sequence which will maintain the original ordering in the subsequent query operators.

Exceptions

source is a null reference (Nothing in Visual Basic).

thrown if source contains no elements

-or-

if AsOrdered is called midway through a query. It is allowed to be called immediately after AsParallel(IEnumerable), Range(Int32, Int32), or Repeat<TResult>(TResult, Int32).

-or-

source is not one of AsParallel(IEnumerable), Range(Int32, Int32), or Repeat<TResult>(TResult, Int32).

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. For more information, see Order Preservation in PLINQ.

See also

Applies to

AsOrdered<TSource>(ParallelQuery<TSource>)

Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs
Source:
ParallelEnumerable.cs

Enables treatment of a data source as if it were ordered, overriding the default of unordered. AsOrdered may only be invoked on generic sequences returned by AsParallel, ParallelEnumerable.Range, and ParallelEnumerable.Repeat.

public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
 static System::Linq::ParallelQuery<TSource> ^ AsOrdered(System::Linq::ParallelQuery<TSource> ^ source);
public static System.Linq.ParallelQuery<TSource> AsOrdered<TSource> (this System.Linq.ParallelQuery<TSource> source);
static member AsOrdered : System.Linq.ParallelQuery<'Source> -> System.Linq.ParallelQuery<'Source>
<Extension()>
Public Function AsOrdered(Of TSource) (source As ParallelQuery(Of TSource)) As ParallelQuery(Of TSource)

Type Parameters

TSource

The type of elements of source.

Parameters

source
ParallelQuery<TSource>

The input sequence.

Returns

The source sequence which will maintain the original ordering in the subsequent query operators.

Exceptions

source is a null reference (Nothing in Visual Basic).

source contains no elements

-or-

source is not one of AsParallel, ParallelEnumerable.Range, or ParallelEnumerable.Repeat.

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. For more information, see Order Preservation in PLINQ.

See also

Applies to