using System; using System.Reactive.Disposables; namespace Avalonia.Reactive { /// /// Provides common observable methods not found in standard Rx framework. /// public static class ObservableEx { /// /// Returns an observable that fires once with the specified value and never completes. /// /// The type of the value. /// The value. /// The observable. public static IObservable SingleValue(T value) { return new SingleValueImpl(value); } private class SingleValueImpl : IObservable { private T _value; public SingleValueImpl(T value) { _value = value; } public IDisposable Subscribe(IObserver observer) { observer.OnNext(_value); return Disposable.Empty; } } } }