Class AnonymousObserver<T>
Class to create an IObserver<T> instance from delegate-based implementations of the On* methods.
Inherited Members
Namespace: System.Reactive
Assembly: System.Reactive.Core.dll
Syntax
public sealed class AnonymousObserver<T> : ObserverBase<T>, IObserver<T>, IDisposable
Type Parameters
Name | Description |
---|---|
T | The type of the elements in the sequence. |
Constructors
| Improve this Doc View SourceAnonymousObserver(Action<T>)
Creates an observer from the specified OnNext action.
Declaration
public AnonymousObserver(Action<T> onNext)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onNext | Observer's OnNext action implementation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AnonymousObserver(Action<T>, Action)
Creates an observer from the specified OnNext and OnCompleted actions.
Declaration
public AnonymousObserver(Action<T> onNext, Action onCompleted)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onNext | Observer's OnNext action implementation. |
Action | onCompleted | Observer's OnCompleted action implementation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AnonymousObserver(Action<T>, Action<Exception>)
Creates an observer from the specified OnNext and OnError actions.
Declaration
public AnonymousObserver(Action<T> onNext, Action<Exception> onError)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onNext | Observer's OnNext action implementation. |
Action<Exception> | onError | Observer's OnError action implementation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
AnonymousObserver(Action<T>, Action<Exception>, Action)
Creates an observer from the specified OnNext, OnError, and OnCompleted actions.
Declaration
public AnonymousObserver(Action<T> onNext, Action<Exception> onError, Action onCompleted)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onNext | Observer's OnNext action implementation. |
Action<Exception> | onError | Observer's OnError action implementation. |
Action | onCompleted | Observer's OnCompleted action implementation. |
Exceptions
Type | Condition |
---|---|
ArgumentNullException |
|
Methods
| Improve this Doc View SourceOnCompletedCore()
Calls the onCompleted action.
Declaration
protected override void OnCompletedCore()
Overrides
OnErrorCore(Exception)
Calls the onError action.
Declaration
protected override void OnErrorCore(Exception error)
Parameters
Type | Name | Description |
---|---|---|
Exception | error | The error that has occurred. |
Overrides
OnNextCore(T)
Calls the onNext action.
Declaration
protected override void OnNextCore(T value)
Parameters
Type | Name | Description |
---|---|---|
T | value | Next element in the sequence. |