The recording of the first ever ReactiveUI virtual conference is available on our YouTube Channel.


AutoPersist<T>(T, Func<T, IObservable<Unit>>, TimeSpan?) Method


AutoPersist allows you to automatically call a method when an object has changed, throttling on a certain interval. Note that this object must mark its persistable properties via the [DataMember] attribute. Changes to properties not marked with DataMember will not trigger the object to be saved.
Containing Type


public static IDisposable AutoPersist<T>(this T this, Func<T, IObservable<Unit>> doPersist, TimeSpan? interval = null) 
    where T : IReactiveObject

Type Parameters

Name Description
T The reactive object type.


Name Type Description
this T The reactive object to watch for changes.
doPersist Func<T, IObservable<Unit>> The asynchronous method to call to save the object to disk.
interval TimeSpan? The interval to save the object on. Note that if an object is constantly changing, it is possible that it will never be saved.

Return Value

Type Description
IDisposable A Disposable to disable automatic persistence.