Returns elements from a sequence as long as a specified condition is true.
Namespace: SequencesAssembly: Sequences (in Sequences.dll) Version: 1.0.1.0 (1.0.1)
Syntax public static ISequence<TSource> TakeWhile<TSource>(
this ISequence<TSource> source,
Func<TSource, bool> predicate
)
public static ISequence<TSource> TakeWhile<TSource>(
this ISequence<TSource> source,
Func<TSource, bool> predicate
)
<ExtensionAttribute>
Public Shared Function TakeWhile(Of TSource) (
source As ISequence(Of TSource),
predicate As Func(Of TSource, Boolean)
) As ISequence(Of TSource)
<ExtensionAttribute>
Public Shared Function TakeWhile(Of TSource) (
source As ISequence(Of TSource),
predicate As Func(Of TSource, Boolean)
) As ISequence(Of TSource)
public:
[ExtensionAttribute]
generic<typename TSource>
static ISequence<TSource>^ TakeWhile(
ISequence<TSource>^ source,
Func<TSource, bool>^ predicate
)
public:
[ExtensionAttribute]
generic<typename TSource>
static ISequence<TSource>^ TakeWhile(
ISequence<TSource>^ source,
Func<TSource, bool>^ predicate
)
static member TakeWhile :
source : ISequence<'TSource> *
predicate : Func<'TSource, bool> -> ISequence<'TSource>
static member TakeWhile :
source : ISequence<'TSource> *
predicate : Func<'TSource, bool> -> ISequence<'TSource>
Parameters
- source
- Type: Sequences ISequence TSource
The sequence to return elements from.
- predicate
- Type: System Func TSource, Boolean
A function to test each element for a condition.
Type Parameters - TSource
- The type of the elements of source.
Return Value
Type:
ISequence TSource A sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.
Usage Note
In Visual Basic and C#, you can call this method as an instance method on any object of type
ISequence TSource . 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).
See Also