AsUnordered(TSource) Method

ParallelEnumerable.AsUnordered<TSource> Method (ParallelQuery<TSource>)

 

Allows an intermediate query to be treated as if no ordering is implied among the elements.

Namespace:   System.Linq
Assembly:  System.Core (in System.Core.dll)

public static ParallelQuery<TSource> AsUnordered<TSource>(
	this ParallelQuery<TSource> source
)

Parameters

source
Type: System.Linq.ParallelQuery<TSource>

The input sequence.

Return Value

Type: System.Linq.ParallelQuery<TSource>

The source sequence with arbitrary order.

Type Parameters

TSource

The type of elements of source.

Exception Condition
ArgumentNullException

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

AsUnordered may provide performance benefits when ordering is not required in a portion of a query. By default, PLINQ treats an input sequence as unordered unless OrderBy or AsOrdered is specified. However, if ordering was turned on and is no longer needed, then AsUnordered can be used to turn it off in mid-query, and this may result in performance benefits.The AsUnordered operator itself does not shuffle the source sequence; it simply removes the ordering requirement for subsequent operators. If the source is ordered, subsequent operators might keep that ordering if it is more efficient to do so. AsUnordered can be called anywhere in the query; it does not need to be called immediately after AsParallel. For more information, see Understanding Speedup in PLINQ and Order Preservation in PLINQ.

Universal Windows Platform
Available since 4.5
.NET Framework
Available since 4.0
Portable Class Library
Supported in: portable .NET platforms
Windows Phone
Available since 8.1
Return to top
Show:
© 2016 Microsoft