Class SharedStateReactiveExtensions
Extension methods on ISharedState for conversion from and to System.Reactive observables.
Inheritance
Namespace: Cortex.Net.Rx
Assembly: Cortex.Net.dll
Syntax
public static class SharedStateReactiveExtensions : object
Methods
| Improve this Doc View SourceAsObservable<T>(ISharedState, Func<T>, Boolean)
Converts an expression to observe into an
Declaration
public static IObservable<T> AsObservable<T>(this ISharedState sharedState, Func<T> expressionToObserve, bool fireImmediately = false)
Parameters
| Type | Name | Description |
|---|---|---|
| ISharedState | sharedState | The shared state to use. |
| Func<T> | expressionToObserve | The expression to observe. |
| System.Boolean | fireImmediately | Whether to fire immediately. |
Returns
| Type | Description |
|---|---|
| Cortex.Net.IObservable<T> | An |
Type Parameters
| Name | Description |
|---|---|
| T | The type to observe. |
Remarks
The provided expression is tracked by Cortex.Net as long as there are subscribers, automatically emitting when new values become available. The expressions respect(trans)actions.
FromObservable<T>(ISharedState, IObservable<T>, T, Action<Exception>)
Converts a Current).
The subscription can be canceled through the Dispose method. Takes an initial value as second optional argument.
Declaration
public static RxObserver<T> FromObservable<T>(this ISharedState sharedState, IObservable<T> observable, T initialValue = null, Action<Exception> exceptionHandler = null)
Parameters
| Type | Name | Description |
|---|---|---|
| ISharedState | sharedState | The shared state to use. |
| Cortex.Net.IObservable<T> | observable | The observable to "convert". |
| T | initialValue | The initial value for the IObservableValue<T>. |
| Action<Exception> | exceptionHandler | The exception handler to use. |
Returns
| Type | Description |
|---|---|
| RxObserver<T> | An observable value. |
Type Parameters
| Name | Description |
|---|---|
| T | The type to observe. |