.NET Framework Class Library
ParallelEnumerableAsParallel Method (IEnumerable)

Enables parallelization of a query.

Namespace:   System.Linq
Assemblies:   System.Linq.Parallel (in System.Linq.Parallel.dll)
  System.Core (in System.Core.dll)
Syntax
<[%$TOPIC/dd413237_en-us_VS_110_1_0_0_0_0%]> _
Public Shared Function AsParallel ( _
	source As [%$TOPIC/dd413237_en-us_VS_110_1_0_0_0_1%] _
) As [%$TOPIC/dd413237_en-us_VS_110_1_0_0_0_2%]
public static [%$TOPIC/dd413237_en-us_VS_110_1_0_1_0_0%] AsParallel(
	this [%$TOPIC/dd413237_en-us_VS_110_1_0_1_0_1%] source
)
[[%$TOPIC/dd413237_en-us_VS_110_1_0_2_0_0%]]
public:
static [%$TOPIC/dd413237_en-us_VS_110_1_0_2_0_1%]^ AsParallel(
	[%$TOPIC/dd413237_en-us_VS_110_1_0_2_0_2%]^ source
)
static member AsParallel : 
        source:[%$TOPIC/dd413237_en-us_VS_110_1_0_3_0_0%] -> [%$TOPIC/dd413237_en-us_VS_110_1_0_3_0_1%]
public static function AsParallel(
	source : [%$TOPIC/dd413237_en-us_VS_110_1_0_4_0_0%]
) : [%$TOPIC/dd413237_en-us_VS_110_1_0_4_0_1%]

Parameters

source
Type: System.CollectionsIEnumerable

An IEnumerableT to convert to a ParallelQuery.

Return Value

Type: System.LinqParallelQuery
The source as a ParallelQuery to bind to ParallelEnumerable extension methods.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IEnumerable. When you use instance method syntax to call this method, omit the first parameter. For more information, see Extension Methods (Visual Basic) or Extension Methods (C# Programming Guide).
Exceptions
ExceptionCondition
ArgumentNullException

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

Remarks

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

Version Information

.NET Framework

Supported in: 4.6, 4.5, 4

.NET Framework Client Profile

Supported in: 4

Portable Class Library

Supported in: Portable Class Library

Supported in: Windows Phone 8.1