Skip to content

,System.Linq.Expressions.Expression{System.Func{--0,System.Boolean}})} ,System.Linq.Expressions.Expression{System.Func{--0,System.Int32,System.Boolean}})}

Qbservable.TakeWhile(IQbservable, Expression>) method

Defined in

Type: Qbservable Namespace: System.Reactive.Linq Assembly: System.Reactive.dll

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)
  • 2. public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)

1. Overload

public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, bool>> predicate)

Summary: Returns elements from an observable sequence as long as a specified condition is true.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#A sequence to return elements from.
predicateExpression>A function to test each element for a condition.

Returns: IQbservable -- An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or predicate is null.

2. Overload

public static IQbservable<TSource> TakeWhile<TSource>(this IQbservable<TSource> source, Expression<Func<TSource, int, bool>> predicate)

Summary: Returns elements from an observable sequence as long as a specified condition is true. The element's index is used in the logic of the predicate function.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#A sequence to return elements from.
predicateExpression>A function to test each element for a condition; the second parameter of the function represents the index of the source element.

Returns: IQbservable -- An observable sequence that contains the elements from the input sequence that occur before the element at which the test no longer passes.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or predicate is null.