},System.IObservable{System.Boolean})} },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.Reactive.Concurrency.IScheduler,System.IObservable{System.Reactive.Unit})} },System.IObservable{System.Boolean},System.Boolean,System.IObservable{System.Reactive.Unit},System.Reactive.Concurrency.IScheduler)}
ObservableCacheEx.BatchIf(IObservable>, IObservable) method¶
Defined in
Type: ObservableCacheEx Namespace: DynamicData Assembly: DynamicData.dll
Applies to
net10.0, netstandard2.0
Overloads¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector) where TObject : notnull where TKey : notnullpublic 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 : notnullpublic static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState, IScheduler? scheduler = null) where TObject : notnull where TKey : notnullpublic static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, TimeSpan? timeOut, IScheduler? scheduler = null) where TObject : notnull where TKey : notnullpublic static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState, TimeSpan? timeOut, IScheduler? scheduler = null) where TObject : notnull where TKey : notnullpublic static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, IScheduler? scheduler = null, IObservable<Unit>? timer = null) where TObject : notnull where TKey : notnullpublic static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState, IObservable<Unit>? timer, 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) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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. |
Returns: IObservable
Remarks
This overload delegates to the primary overload with initialPauseState: false and no scheduler.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException (opens in a new tab) | 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, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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 (opens in a new tab) | 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, bool initialPauseState, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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 | bool (opens in a new tab) | 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 (opens in a new tab) | 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, TimeSpan? timeOut, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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 | TimeSpan? (opens in a new tab) | A TimeSpan (opens in a new tab) 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 (opens in a new tab) | 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, TimeSpan? timeOut, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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 | bool (opens in a new tab) | If true, starts in a paused (buffering) state. |
timeOut | TimeSpan? (opens in a new tab) | A TimeSpan (opens in a new tab) 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 (opens in a new tab) | 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)
6. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, IScheduler? scheduler = null, IObservable<Unit>? timer = null) where TObject : notnull where TKey : notnull
View source (opens in a new tab)
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. |
scheduler = null | [IScheduler?](# | An optional [IScheduler](# retained only for source compatibility. It does not schedule any work on this overload: the operator schedules work solely to honour a TimeSpan (opens in a new tab) timeout, and this overload always forwards a null timeout, so the value is unused whether or not timer is supplied. A supplied timer controls its own scheduling. Use [BatchIf](# for scheduler-driven timing. |
timer = null | IObservable | An optional IObservable (opens in a new tab) timer. The buffer is flushed each time the timer produces a value, and buffering ceases when it completes. |
Returns: IObservable
Remarks
This overload starts unpaused. It exists so that a named timer argument, with or without a named scheduler, is a supported call shape without supplying an initial pause state.
The parameter order and the absence of an initialPauseState parameter are both deliberate, and changing either reintroduces a compile error in previously valid code. Declaring scheduler before timer keeps the fourth positional parameter incompatible with IScheduler, so BatchIf(pauseIfTrueSelector, null, scheduler) still binds unambiguously to the TimeSpan (opens in a new tab) timeout overload. Omitting initialPauseState keeps a fully named call that supplies an initial pause state bound unambiguously to the overload that accepts one.
Supply an initial pause state through BatchIf.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException (opens in a new tab) | source or pauseIfTrueSelector is null. |
See also
7. Overload¶
public static IObservable<IChangeSet<TObject, TKey>> BatchIf<TObject, TKey>(this IObservable<IChangeSet<TObject, TKey>> source, IObservable<bool> pauseIfTrueSelector, bool initialPauseState, IObservable<Unit>? timer, IScheduler? scheduler = null) where TObject : notnull where TKey : notnull
:material-source-branch: View source (opens in a new tab)
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 | bool (opens in a new tab) | If true, starts in a paused (buffering) state. |
timer | IObservable | An optional IObservable (opens in a new tab) 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 (opens in a new tab) timeout.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException (opens in a new tab) | source or pauseIfTrueSelector is null. |
See also