Skip to content

Latest commit

 

History

History
40 lines (26 loc) · 781 Bytes

README.md

File metadata and controls

40 lines (26 loc) · 781 Bytes

ObservableValue

NuGet

A simple observable (IObservable<T>) that when its value is updated (value changes), its observers are notified.
Will post current value (if initialized) when subscribing. Synchronized to ensure ordering.

System.Reactive is included and can be used to extend its behavior.

Usage

Namespace

using Open.Observable;

Creating

var value = new ObservableValue<int>(1 /* optional initial value */);

or

var value = ObservableValue.Create(1); // type inferred

Subscribing

value.Subscribe(v => { /* do something with the value */ });

Updating

var changed = value.Post(2);