Interface IObserver<TValue, TResult>
Provides a mechanism for receiving push-based notifications and returning a response.
Namespace: System.Reactive
Assembly: System.Reactive.Interfaces.dll
Syntax
public interface IObserver<in TValue, out TResult>
Type Parameters
| Name | Description |
|---|---|
| TValue | The type of the elements received by the observer. This type parameter is contravariant. That is, you can use either the type you specified or any type that is less derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. |
| TResult | The type of the result returned from the observer's notification handlers. This type parameter is covariant. That is, you can use either the type you specified or any type that is more derived. For more information about covariance and contravariance, see Covariance and Contravariance in Generics. |
Methods
| Improve this Doc View SourceOnCompleted()
Notifies the observer of the end of the sequence.
Declaration
TResult OnCompleted()
Returns
| Type | Description |
|---|---|
| TResult | Result returned upon observation of the sequence completion. |
OnError(Exception)
Notifies the observer that an exception has occurred.
Declaration
TResult OnError(Exception exception)
Parameters
| Type | Name | Description |
|---|---|---|
| Exception | exception | The exception that occurred. |
Returns
| Type | Description |
|---|---|
| TResult | Result returned upon observation of an error. |
OnNext(TValue)
Notifies the observer of a new element in the sequence.
Declaration
TResult OnNext(TValue value)
Parameters
| Type | Name | Description |
|---|---|---|
| TValue | value | The new element in the sequence. |
Returns
| Type | Description |
|---|---|
| TResult | Result returned upon observation of a new element. |