},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)} },System.Linq.Expressions.Expression{System.Func{--0,--1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)}
ObservableListEx.AutoRefresh(IObservable>, TimeSpan?, TimeSpan?, IScheduler?) method¶
Defined in
Type: ObservableListEx
Namespace: DynamicData
Assembly: DynamicData.dll
Applies to
net10.0, netstandard2.0
Overloads¶
-
public static IObservable<IChangeSet<TObject>> AutoRefresh<TObject>(this IObservable<IChangeSet<TObject>> source, TimeSpan? changeSetBuffer = null, TimeSpan? propertyChangeThrottle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged -
public static IObservable<IChangeSet<TObject>> AutoRefresh<TObject, TProperty>(this IObservable<IChangeSet<TObject>> source, Expression<Func<TObject, TProperty>> propertyAccessor, TimeSpan? changeSetBuffer = null, TimeSpan? propertyChangeThrottle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged
1. Overload¶
public static IObservable<IChangeSet<TObject>> AutoRefresh<TObject>(this IObservable<IChangeSet<TObject>> source, TimeSpan? changeSetBuffer = null, TimeSpan? propertyChangeThrottle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged
Summary: Monitors all properties on each item (via INotifyPropertyChanged) and emits Refresh changes when any property changes, causing downstream operators to re-evaluate.
Type parameters
| Name | Description |
|---|---|
TObject | The type of items, which must implement INotifyPropertyChanged. |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject>> to monitor for property-driven refresh signals. |
changeSetBuffer = null | TimeSpan? | An optional TimeSpan buffer duration to batch multiple refresh signals into a single changeset. |
propertyChangeThrottle = null | TimeSpan? | An optional TimeSpan throttle applied to each item's property change notifications. |
scheduler = null | [IScheduler?](# | The scheduler for throttle and buffer timing. Defaults to DefaultScheduler. |
Returns: IObservable
Remarks
Wraps AutoRefreshOnObservable using WhenAnyPropertyChanged() as the re-evaluator.
Pair with Filter or [Sort][M:DynamicData.ObservableListEx.Sort--1(System.IObservable{DynamicData.IChangeSet{--0}},System.Collections.Generic.IComparer{--0},DynamicData.SortOptions,System.IObservable{System.Reactive.Unit},System.IObservable{System.Collections.Generic.IComparer{--0}},System.Int32)]
to get reactive re-evaluation on property changes.
| Event | Behavior |
|---|---|
| Add/AddRange | Subscribes to PropertyChanged on each new item. The original change is forwarded. |
| Replace | Unsubscribes from the old item, subscribes to the new. The original change is forwarded. |
| Remove/RemoveRange/Clear | Unsubscribes from removed items. The original change is forwarded. |
| Moved/Refresh | Forwarded unchanged. |
| Property changes | A Refresh change is emitted for the item whose property changed. |
Worth noting: Each item generates a subscription. For large lists with frequent property changes, use changeSetBuffer and propertyChangeThrottle to reduce churn.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
See also
- [DynamicData.ObservableListEx.AutoRefresh
2(System.IObservable{DynamicData.IChangeSet{0}},System.Linq.Expressions.Expression{System.Func{0,1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)][M:DynamicData.ObservableListEx.AutoRefresh--2(System.IObservable{DynamicData.IChangeSet{--0}},System.Linq.Expressions.Expression{System.Func{--0,--1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)] - DynamicData.ObservableListEx.AutoRefreshOnObservable
2(System.IObservable{DynamicData.IChangeSet{0}},System.Func{0,System.IObservable{1}},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableListEx.SuppressRefresh
1(System.IObservable{DynamicData.IChangeSet{0}}) - DynamicData.ObservableCacheEx.AutoRefresh
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)
2. Overload¶
public static IObservable<IChangeSet<TObject>> AutoRefresh<TObject, TProperty>(this IObservable<IChangeSet<TObject>> source, Expression<Func<TObject, TProperty>> propertyAccessor, TimeSpan? changeSetBuffer = null, TimeSpan? propertyChangeThrottle = null, IScheduler? scheduler = null) where TObject : INotifyPropertyChanged
:material-source-branch: View source
Inherited documentation
These docs were inherited from ObservableListEx. The member doesn't override them on this type.
Summary:
Monitors a single property (selected by propertyAccessor) on each item via INotifyPropertyChanged
and emits Refresh changes when that property changes, causing downstream operators to re-evaluate. More efficient than
the all-properties overload when only one property (of type TProperty) affects downstream behavior.
Type parameters
| Name | Description |
|---|---|
TObject | The type of items, which must implement INotifyPropertyChanged. |
TProperty | -- |
Parameters
| Name | Type | Description |
|---|---|---|
source | IObservable | The source IObservable<IChangeSet<TObject>> to monitor for property-driven refresh signals. |
propertyAccessor | Expression | -- |
changeSetBuffer = null | TimeSpan? | An optional TimeSpan buffer duration to batch multiple refresh signals into a single changeset. |
propertyChangeThrottle = null | TimeSpan? | An optional TimeSpan throttle applied to each item's property change notifications. |
scheduler = null | [IScheduler?](# | The scheduler for throttle and buffer timing. Defaults to DefaultScheduler. |
Returns: IObservable
Remarks
Wraps AutoRefreshOnObservable using WhenAnyPropertyChanged() as the re-evaluator.
Pair with Filter or [Sort][M:DynamicData.ObservableListEx.Sort--1(System.IObservable{DynamicData.IChangeSet{--0}},System.Collections.Generic.IComparer{--0},DynamicData.SortOptions,System.IObservable{System.Reactive.Unit},System.IObservable{System.Collections.Generic.IComparer{--0}},System.Int32)]
to get reactive re-evaluation on property changes.
| Event | Behavior |
|---|---|
| Add/AddRange | Subscribes to PropertyChanged on each new item. The original change is forwarded. |
| Replace | Unsubscribes from the old item, subscribes to the new. The original change is forwarded. |
| Remove/RemoveRange/Clear | Unsubscribes from removed items. The original change is forwarded. |
| Moved/Refresh | Forwarded unchanged. |
| Property changes | A Refresh change is emitted for the item whose property changed. |
Worth noting: Each item generates a subscription. For large lists with frequent property changes, use changeSetBuffer and propertyChangeThrottle to reduce churn.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentNullException | source is null. |
See also
- [DynamicData.ObservableListEx.AutoRefresh
2(System.IObservable{DynamicData.IChangeSet{0}},System.Linq.Expressions.Expression{System.Func{0,1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)][M:DynamicData.ObservableListEx.AutoRefresh--2(System.IObservable{DynamicData.IChangeSet{--0}},System.Linq.Expressions.Expression{System.Func{--0,--1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)] - DynamicData.ObservableListEx.AutoRefreshOnObservable
2(System.IObservable{DynamicData.IChangeSet{0}},System.Func{0,System.IObservable{1}},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler) - DynamicData.ObservableListEx.SuppressRefresh
1(System.IObservable{DynamicData.IChangeSet{0}}) - DynamicData.ObservableCacheEx.AutoRefresh
2(System.IObservable{DynamicData.IChangeSet{0,``1}},System.Nullable{System.TimeSpan},System.Nullable{System.TimeSpan},System.Reactive.Concurrency.IScheduler)