ParallelEnumerable.AsParallel Method

Definition

Enables parallelization of a query.

Overloads

AsParallel(IEnumerable)

Enables parallelization of a query.

AsParallel<TSource>(Partitioner<TSource>)

Enables parallelization of a query, as sourced by a custom partitioner that is responsible for splitting the input sequence into partitions.

AsParallel<TSource>(IEnumerable<TSource>)

Enables parallelization of a query.

Remarks

This method binds the query to PLINQ. For more information, see Parallel LINQ (PLINQ).

AsParallel(IEnumerable)

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

Enables parallelization of a query.

public static System.Linq.ParallelQuery AsParallel (this System.Collections.IEnumerable source);

Parameters

source
IEnumerable

An IEnumerable<T> to convert to a ParallelQuery.

Returns

The source as a ParallelQuery to bind to ParallelEnumerable extension methods.

Exceptions

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

Remarks

The Cast operator can be used to convert a ParallelQuery to a ParallelQuery(T).

See also

Applies to

.NET 9 en andere versies
Product Versies
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

AsParallel<TSource>(Partitioner<TSource>)

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

Enables parallelization of a query, as sourced by a custom partitioner that is responsible for splitting the input sequence into partitions.

public static System.Linq.ParallelQuery<TSource> AsParallel<TSource> (this System.Collections.Concurrent.Partitioner<TSource> source);

Type Parameters

TSource

The type of elements of source.

Parameters

source
Partitioner<TSource>

A partitioner over the input sequence.

Returns

The source as a ParallelQuery to bind to ParallelEnumerable extension methods.

Exceptions

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

Remarks

The source partitioner's GetOrderedPartitions method is used when ordering is enabled, whereas the partitioner's GetPartitions is used if ordering is not enabled (the default). The source partitioner's GetDynamicPartitions and GetDynamicOrderedPartitions are not used. For more information and examples, see Custom Partitioners for PLINQ and TPL.

See also

Applies to

.NET 9 en andere versies
Product Versies
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0

AsParallel<TSource>(IEnumerable<TSource>)

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

Enables parallelization of a query.

public static System.Linq.ParallelQuery<TSource> AsParallel<TSource> (this System.Collections.Generic.IEnumerable<TSource> source);

Type Parameters

TSource

The type of elements of source.

Parameters

source
IEnumerable<TSource>

An IEnumerable<T> to convert to a ParallelQuery<TSource>.

Returns

The source as a ParallelQuery<TSource> to bind to ParallelEnumerable extension methods.

Exceptions

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

See also

Applies to

.NET 9 en andere versies
Product Versies
.NET Core 1.0, Core 1.1, Core 2.0, Core 2.1, Core 2.2, Core 3.0, Core 3.1, 5, 6, 7, 8, 9
.NET Framework 4.0, 4.5, 4.5.1, 4.5.2, 4.6, 4.6.1, 4.6.2, 4.7, 4.7.1, 4.7.2, 4.8, 4.8.1
.NET Standard 2.0, 2.1
UWP 10.0