},System.IObservable{System.Boolean},System.Reactive.Concurrency.IScheduler)} },System.IObservable{System.Boolean},System.Boolean,System.Reactive.Concurrency.IScheduler)} },System.IObservable{System.Boolean},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)} },System.IObservable{System.Boolean},System.Boolean,System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)} },System.IObservable{System.Boolean},System.Boolean,System.IObservable{System.Reactive.Unit},System.Reactive.Concurrency.IScheduler)}
ObservableCacheEx.BatchIf(IObservable>, IObservable, IScheduler?) method¶
Defined in
Type: ObservableCacheEx
Namespace: DynamicData
Assembly: DynamicData.dll
Applies to
net10.0, net10.0-browserwasm1.0, net10.0-desktop1.0, net9.0, net9.0-browserwasm1.0, net9.0-desktop1.0, net8.0, net8.0-ios17.5, net8.0-maccatalyst17.5, net8.0-macos14.2, net8.0-macos14.5, net8.0-tvos17.2, netstandard2.1, netstandard2.0, net462, net471
Overloads¶
- 1.
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull - 2.
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull - 3.
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, TimeSpan? timeOut = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull - 4.
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, TimeSpan? timeOut = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull - 5.
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, IObservable<Unit>? timer = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
1. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
Inherited documentation
These docs were inherited from ObservableCacheEx. The member doesn't override them on this type.
Summary: Conditionally buffers changesets while a pause signal is active, then flushes all buffered changes as a single merged changeset when the signal resumes.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object. |
TKey | The type of the key. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer. |
pauseIfTrueSelector | IObservable | An IObservable<bool> that when true, buffering begins. When false, the buffer is flushed. |
scheduler = null | [IScheduler?](# | The [IScheduler](# for timeout timing. |
Returns: IObservable
Remarks
This overload delegates to the primary overload with initialPauseState: false.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or pauseIfTrueSelector is null. |
See also
- DynamicData.ObservableCacheEx.Batch
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableCacheEx.BufferInitial
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler)
2. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
Inherited documentation
These docs were inherited from ObservableCacheEx. The member doesn't override them on this type.
Summary: Conditionally buffers changesets while a pause signal is active, then flushes all buffered changes as a single merged changeset when the signal resumes.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object. |
TKey | The type of the key. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer. |
pauseIfTrueSelector | IObservable | An IObservable<bool> that when true, buffering begins. When false, the buffer is flushed. |
initialPauseState = false | bool | If true, starts in a paused (buffering) state. |
scheduler = null | [IScheduler?](# | The [IScheduler](# for timeout timing. |
Returns: IObservable
Remarks
This overload delegates to the primary overload with default initialPauseState: false.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or pauseIfTrueSelector is null. |
See also
- DynamicData.ObservableCacheEx.Batch
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableCacheEx.BufferInitial
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler)
3. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, TimeSpan? timeOut = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
Inherited documentation
These docs were inherited from ObservableCacheEx. The member doesn't override them on this type.
Summary: Conditionally buffers changesets while a pause signal is active, then flushes all buffered changes as a single merged changeset when the signal resumes.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object. |
TKey | The type of the key. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer. |
pauseIfTrueSelector | IObservable | An IObservable<bool> that when true, buffering begins. When false, the buffer is flushed. |
timeOut = null | TimeSpan? | A TimeSpan that maximum time the buffer stays open. When elapsed, the buffer is flushed regardless of pause state. |
scheduler = null | [IScheduler?](# | The [IScheduler](# for timeout timing. |
Returns: IObservable
Remarks
This overload omits initialPauseState (defaults to false) but accepts a timeout.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or pauseIfTrueSelector is null. |
See also
- DynamicData.ObservableCacheEx.Batch
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableCacheEx.BufferInitial
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler)
4. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, TimeSpan? timeOut = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
Summary: Conditionally buffers changesets while a pause signal is active, then flushes all buffered changes as a single merged changeset when the signal resumes.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object. |
TKey | The type of the key. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer. |
pauseIfTrueSelector | IObservable | An IObservable<bool> that when true, buffering begins. When false, the buffer is flushed. |
initialPauseState = false | bool | If true, starts in a paused (buffering) state. |
timeOut = null | TimeSpan? | A TimeSpan that maximum time the buffer stays open. When elapsed, the buffer is flushed regardless of pause state. |
scheduler = null | [IScheduler?](# | The [IScheduler](# for timeout timing. |
Returns: IObservable
Remarks
While paused, incoming changesets are accumulated. On resume (or timeout), all buffered changesets are merged into a single changeset and emitted. While not paused, changesets pass through immediately.
| Event | Behavior |
|---|---|
| Add | Buffered while paused; forwarded immediately while active. |
| Update | Buffered while paused; forwarded immediately while active. |
| Remove | Buffered while paused; forwarded immediately while active. |
| Refresh | Buffered while paused; forwarded immediately while active. |
| OnError | Buffered data is lost. |
| OnCompleted | Any remaining buffered data is flushed before completion. |
Worth noting: If the source completes while paused, buffered data IS flushed before OnCompleted. However, if the source errors while paused, buffered data is lost.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or pauseIfTrueSelector is null. |
See also
- DynamicData.ObservableCacheEx.Batch
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableCacheEx.BufferInitial
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.TimeSpan,System.Reactive.Concurrency.IScheduler)
5. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState = false, IObservable<Unit>? timer = null, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
Inherited documentation
These docs were inherited from ObservableCacheEx. The member doesn't override them on this type.
Summary: Conditionally buffers changesets while a pause signal is active, then flushes all buffered changes as a single merged changeset when the signal resumes.
Type parameters
| Name | Description |
|---|---|
TObject | The type of the object. |
TKey | The type of the key. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer. |
pauseIfTrueSelector | IObservable | An IObservable<bool> that controls buffering: true begins buffering, false flushes the buffer. |
initialPauseState = false | bool | If true, starts in a paused (buffering) state. |
timer = null | IObservable | An optional IObservable timer. The buffer is flushed each time the timer produces a value, and buffering ceases when it completes. |
scheduler = null | [IScheduler?](# | An optional [IScheduler](# for scheduling work. |
Returns: IObservable
Remarks
This overload accepts an explicit timer observable instead of a TimeSpan timeout.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source or pauseIfTrueSelector is null. |
See also