Skip to content

,System.DateTimeOffset)} ,System.DateTimeOffset,System.IObservable{--0})} ,System.DateTimeOffset,System.IObservable{--0},System.Reactive.Concurrency.IScheduler)} ,System.DateTimeOffset,System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan)} ,System.TimeSpan,System.IObservable{--0})} ,System.TimeSpan,System.IObservable{--0},System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan,System.Reactive.Concurrency.IScheduler)} ,System.IObservable{--1},System.Linq.Expressions.Expression{System.Func{--0,System.IObservable{--1}}})} ,System.IObservable{--1},System.Linq.Expressions.Expression{System.Func{--0,System.IObservable{--1}}},System.IObservable{--0})} ,System.Linq.Expressions.Expression{System.Func{--0,System.IObservable{--1}}})} ,System.Linq.Expressions.Expression{System.Func{--0,System.IObservable{--1}}},System.IObservable{--0})}

Qbservable.Timeout(IQbservable, DateTimeOffset) method

Defined in

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

Applies to

netstandard2.0

Overloads

  • 1. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)
  • 2. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)
  • 3. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)
  • 4. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)
  • 5. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)
  • 6. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)
  • 7. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)
  • 8. public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)
  • 9. public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
  • 10. public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)
  • 11. public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)
  • 12. public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)

1. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime)

Summary: Applies a timeout policy to the observable sequence based on an absolute time. If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeDateTimeOffsetTime when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.TimeoutException(Asynchronous) If the sequence hasn't terminated before dueTime.

2. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other)

Summary: Applies a timeout policy to the observable sequence based on an absolute time. If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeDateTimeOffsetTime when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.
otherIObservableSequence to return in case of a timeout.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or other is null.

3. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IObservable<TSource> other, IScheduler scheduler)

Summary: Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers. If the sequence doesn't terminate before the specified absolute due time, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeDateTimeOffsetTime when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.
otherIObservableSequence to return in case of a timeout.
scheduler[IScheduler](#Scheduler to run the timeout timers on.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or other or scheduler is null.

4. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, DateTimeOffset dueTime, IScheduler scheduler)

Summary: Applies a timeout policy to the observable sequence based on an absolute time, using the specified scheduler to run timeout timers. If the sequence doesn't terminate before the specified absolute due time, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeDateTimeOffsetTime when a timeout occurs. If this value is less than or equal to DateTimeOffset.UtcNow, the timeout occurs immediately.
scheduler[IScheduler](#Scheduler to run the timeout timers on.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.
System.TimeoutException(Asynchronous) If the sequence hasn't terminated before dueTime.

5. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime)

Summary: Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeTimeSpanMaximum duration between values before a timeout occurs.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Specifying a TimeSpan.Zero value for dueTime is not recommended but supported, causing timeout timers to be scheduled that are due immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may arrive before the scheduler gets a chance to run the timeout action.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource is null.
System.ArgumentOutOfRangeExceptiondueTime is less than TimeSpan.Zero.
System.TimeoutException(Asynchronous) If no element is produced within dueTime from the previous element.

6. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other)

Summary: Applies a timeout policy for each element in the observable sequence. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeTimeSpanMaximum duration between values before a timeout occurs.
otherIObservableSequence to return in case of a timeout.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Specifying a TimeSpan.Zero value for dueTime is not recommended but supported, causing timeout timers to be scheduled that are due immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may arrive before the scheduler gets a chance to run the timeout action.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or other is null.
System.ArgumentOutOfRangeExceptiondueTime is less than TimeSpan.Zero.

7. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IObservable<TSource> other, IScheduler scheduler)

Summary: Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeTimeSpanMaximum duration between values before a timeout occurs.
otherIObservableSequence to return in case of a timeout.
scheduler[IScheduler](#Scheduler to run the timeout timers on.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Specifying a TimeSpan.Zero value for dueTime is not recommended but supported, causing timeout timers to be scheduled that are due immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may arrive before the scheduler gets a chance to run the timeout action.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or other or scheduler is null.
System.ArgumentOutOfRangeExceptiondueTime is less than TimeSpan.Zero.

8. Overload

public static IQbservable<TSource> Timeout<TSource>(this IQbservable<TSource> source, TimeSpan dueTime, IScheduler scheduler)

Summary: Applies a timeout policy for each element in the observable sequence, using the specified scheduler to run timeout timers. If the next element isn't received within the specified timeout duration starting from its predecessor, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
dueTimeTimeSpanMaximum duration between values before a timeout occurs.
scheduler[IScheduler](#Scheduler to run the timeout timers on.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Remarks

In case you only want to timeout on the first element, consider using the Amb operator applied to the source sequence and a delayed Throw sequence. Alternatively, the general-purpose overload of Timeout, Timeout can be used.

Specifying a TimeSpan.Zero value for dueTime is not recommended but supported, causing timeout timers to be scheduled that are due immediately. However, this doesn't guarantee a timeout will occur, even for the first element. This is a side-effect of the asynchrony introduced by the scheduler, where the action to propagate a timeout may not execute immediately, despite the TimeSpan.Zero due time. In such cases, the next element may arrive before the scheduler gets a chance to run the timeout action.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or scheduler is null.
System.ArgumentOutOfRangeExceptiondueTime is less than TimeSpan.Zero.
System.TimeoutException(Asynchronous) If no element is produced within dueTime from the previous element.

9. Overload

public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)

Summary: Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element. If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TTimeoutThe type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
firstTimeoutIObservableObservable sequence that represents the timeout for the first element.
timeoutDurationSelectorExpression>>Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or firstTimeout or timeoutDurationSelector is null.

10. Overload

public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, IObservable<TTimeout> firstTimeout, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)

Summary: Applies a timeout policy to the observable sequence based on an initial timeout duration for the first element, and a timeout duration computed for each subsequent element. If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.
TTimeoutThe type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
firstTimeoutIObservableObservable sequence that represents the timeout for the first element.
timeoutDurationSelectorExpression>>Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
otherIObservableSequence to return in case of a timeout.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or firstTimeout or timeoutDurationSelector or other is null.

11. Overload

public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector)

Summary: Applies a timeout policy to the observable sequence based on a timeout duration computed for each element. If the next element isn't received within the computed duration starting from its predecessor, a TimeoutException is propagated to the observer.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence.
TTimeoutThe type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
timeoutDurationSelectorExpression>>Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.

Returns: IQbservable -- The source sequence with a TimeoutException in case of a timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or timeoutDurationSelector is null.

12. Overload

public static IQbservable<TSource> Timeout<TSource, TTimeout>(this IQbservable<TSource> source, Expression<Func<TSource, IObservable<TTimeout>>> timeoutDurationSelector, IObservable<TSource> other)

Summary: Applies a timeout policy to the observable sequence based on a timeout duration computed for each element. If the next element isn't received within the computed duration starting from its predecessor, the other observable sequence is used to produce future messages from that point on.

Type parameters

NameDescription
TSourceThe type of the elements in the source sequence and the other sequence used upon a timeout.
TTimeoutThe type of the elements in the timeout sequences used to indicate the timeout duration for each element in the source sequence.

Parameters

NameTypeDescription
source[IQbservable](#Source sequence to perform a timeout for.
timeoutDurationSelectorExpression>>Selector to retrieve an observable sequence that represents the timeout between the current element and the next element.
otherIObservableSequence to return in case of a timeout.

Returns: IQbservable -- The source sequence switching to the other sequence in case of a timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or timeoutDurationSelector or other is null.