,System.Int32)} ,System.Int32,System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan)} ,System.TimeSpan,System.Reactive.Concurrency.IScheduler)} ,System.TimeSpan,System.Reactive.Concurrency.IScheduler,System.Reactive.Concurrency.IScheduler)}
Observable.TakeLast(IObservable, int) method¶
Defined in
Type: Observable
Namespace: System.Reactive.Linq
Assembly: System.Reactive.dll
Applies to
netstandard2.0
Overloads¶
- 1.
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count) - 2.
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count, IScheduler scheduler) - 3.
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration) - 4.
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler) - 5.
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
1. Overload¶
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count)
Summary: Returns a specified number of contiguous elements from the end of an observable sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
count | int | Number of elements to take from the end of the source sequence. |
Returns: IObservable
Remarks
This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
| System.ArgumentOutOfRangeException | count is less than zero. |
2. Overload¶
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, int count, IScheduler scheduler)
Summary: Returns a specified number of contiguous elements from the end of an observable sequence, using the specified scheduler to drain the queue.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence. |
count | int | Number of elements to take from the end of the source sequence. |
scheduler | [IScheduler](# | Scheduler used to drain the queue upon completion of the source sequence. |
Returns: IObservable
Remarks
This operator accumulates a buffer with a length enough to store elements count elements. Upon completion of
the source sequence, this buffer is drained on the result sequence. This causes the elements to be delayed.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or scheduler is null. |
| System.ArgumentOutOfRangeException | count is less than zero. |
3. Overload¶
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration)
Summary: Returns elements within the specified duration from the end of the observable source sequence.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence to take elements from. |
duration | TimeSpan | Duration for taking elements from the end of the sequence. |
Returns: IObservable
Remarks
This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
to be delayed with duration.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
| System.ArgumentOutOfRangeException | duration is less than TimeSpan.Zero. |
4. Overload¶
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler scheduler)
Summary: Returns elements within the specified duration from the end of the observable source sequence, using the specified scheduler to run timers.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence to take elements from. |
duration | TimeSpan | Duration for taking elements from the end of the sequence. |
scheduler | [IScheduler](# | Scheduler to run the timer on. |
Returns: IObservable
Remarks
This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
to be delayed with duration.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or scheduler is null. |
| System.ArgumentOutOfRangeException | duration is less than TimeSpan.Zero. |
5. Overload¶
public static IObservable<TSource> TakeLast<TSource>(this IObservable<TSource> source, TimeSpan duration, IScheduler timerScheduler, IScheduler loopScheduler)
Summary: Returns elements within the specified duration from the end of the observable source sequence, using the specified schedulers to run timers and to drain the collected elements.
Type parameters
| Name | Description |
|---|---|
TSource | The type of the elements in the source sequence. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | Source sequence to take elements from. |
duration | TimeSpan | Duration for taking elements from the end of the sequence. |
timerScheduler | [IScheduler](# | Scheduler to run the timer on. |
loopScheduler | [IScheduler](# | Scheduler to drain the collected elements. |
Returns: IObservable
Remarks
This operator accumulates a buffer with a length enough to store elements for any duration window during the lifetime of
the source sequence. Upon completion of the source sequence, this buffer is drained on the result sequence. This causes the result elements
to be delayed with duration.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or timerScheduler or loopScheduler is null. |
| System.ArgumentOutOfRangeException | duration is less than TimeSpan.Zero. |