TakeWhile(TSource) Method (ParallelQuery(TSource), Func(TSource, Boolean))

Task Parallel System.Threading

Returns elements from a parallel sequence as long as a specified condition is true.

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

Syntax

Visual Basic (Declaration)
Public Shared Function TakeWhile(Of TSource) ( _
	source As ParallelQuery(Of TSource), _
	predicate As Func(Of TSource, Boolean) _
) As ParallelQuery(Of TSource)
C#
public static ParallelQuery<TSource> TakeWhile<TSource>(
	ParallelQuery<TSource> source,
	Func<TSource, bool> predicate
)

Parameters

source
Type: System.Linq..::.ParallelQuery<(Of <(TSource>)>)
The sequence to return elements from.
predicate
Type: System..::.Func<(Of <(TSource, Boolean>)>)
A function to test each element for a condition.

Type Parameters

TSource
The type of elements of source.

Return Value

A sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

Exceptions

ExceptionCondition
System..::.ArgumentNullException source or predicate is a null reference (Nothing in Visual Basic).

See Also