Skip to content

},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

View source

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

NameDescription
TObjectThe type of the object.
TKeyThe type of the key.

Parameters

NameTypeDescription
sourceIObservable>The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer.
pauseIfTrueSelectorIObservableAn IObservable<bool> that when true, buffering begins. When false, the buffer is flushed.
scheduler = null[IScheduler?](#The [IScheduler](# for timeout timing.

Returns: IObservable> -- An observable that emits changesets, buffered or passthrough depending on pause state.

Remarks

This overload delegates to the primary overload with initialPauseState: false.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or pauseIfTrueSelector is null.

See also

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

View source

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

NameDescription
TObjectThe type of the object.
TKeyThe type of the key.

Parameters

NameTypeDescription
sourceIObservable>The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer.
pauseIfTrueSelectorIObservableAn IObservable<bool> that when true, buffering begins. When false, the buffer is flushed.
initialPauseState = falseboolIf true, starts in a paused (buffering) state.
scheduler = null[IScheduler?](#The [IScheduler](# for timeout timing.

Returns: IObservable> -- An observable that emits changesets, buffered or passthrough depending on pause state.

Remarks

This overload delegates to the primary overload with default initialPauseState: false.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or pauseIfTrueSelector is null.

See also

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

View source

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

NameDescription
TObjectThe type of the object.
TKeyThe type of the key.

Parameters

NameTypeDescription
sourceIObservable>The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer.
pauseIfTrueSelectorIObservableAn IObservable<bool> that when true, buffering begins. When false, the buffer is flushed.
timeOut = nullTimeSpan?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> -- An observable that emits changesets, buffered or passthrough depending on pause state.

Remarks

This overload omits initialPauseState (defaults to false) but accepts a timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or pauseIfTrueSelector is null.

See also

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

View source

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

NameDescription
TObjectThe type of the object.
TKeyThe type of the key.

Parameters

NameTypeDescription
sourceIObservable>The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer.
pauseIfTrueSelectorIObservableAn IObservable<bool> that when true, buffering begins. When false, the buffer is flushed.
initialPauseState = falseboolIf true, starts in a paused (buffering) state.
timeOut = nullTimeSpan?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> -- An observable that emits changesets, buffered or passthrough depending on pause state.

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.

EventBehavior
AddBuffered while paused; forwarded immediately while active.
UpdateBuffered while paused; forwarded immediately while active.
RemoveBuffered while paused; forwarded immediately while active.
RefreshBuffered while paused; forwarded immediately while active.
OnErrorBuffered data is lost.
OnCompletedAny 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

TypeCondition
System.ArgumentNullExceptionsource or pauseIfTrueSelector is null.

See also

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

View source

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

NameDescription
TObjectThe type of the object.
TKeyThe type of the key.

Parameters

NameTypeDescription
sourceIObservable>The source IObservable<IChangeSet<TObject, TKey>> to conditionally buffer.
pauseIfTrueSelectorIObservableAn IObservable<bool> that controls buffering: true begins buffering, false flushes the buffer.
initialPauseState = falseboolIf true, starts in a paused (buffering) state.
timer = nullIObservable?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> -- An observable that emits changesets, buffered or passthrough depending on pause state.

Remarks

This overload accepts an explicit timer observable instead of a TimeSpan timeout.

Exceptions

TypeCondition
System.ArgumentNullExceptionsource or pauseIfTrueSelector is null.

See also