Class Notification<T>
Represents a notification to an observer.
Implements
Inherited Members
Namespace: System.Reactive
Assembly: System.Reactive.Core.dll
Syntax
[Serializable]
public abstract class Notification<T> : IEquatable<Notification<T>>
Type Parameters
Name | Description |
---|---|
T | The type of the elements received by the observer. |
Constructors
| Improve this Doc View SourceNotification()
Default constructor used by derived types.
Declaration
protected Notification()
Properties
| Improve this Doc View SourceException
Returns the exception of an OnError notification or returns null.
Declaration
public abstract Exception Exception { get; }
Property Value
Type | Description |
---|---|
Exception |
HasValue
Returns a value that indicates whether the notification has a value.
Declaration
public abstract bool HasValue { get; }
Property Value
Type | Description |
---|---|
Boolean |
Kind
Gets the kind of notification that is represented.
Declaration
public abstract NotificationKind Kind { get; }
Property Value
Type | Description |
---|---|
NotificationKind |
Value
Returns the value of an OnNext notification or throws an exception.
Declaration
public abstract T Value { get; }
Property Value
Type | Description |
---|---|
T |
Methods
| Improve this Doc View SourceAccept(Action<T>, Action<Exception>, Action)
Invokes the delegate corresponding to the notification.
Declaration
public abstract void Accept(Action<T> onNext, Action<Exception> onError, Action onCompleted)
Parameters
Type | Name | Description |
---|---|---|
Action<T> | onNext | Delegate to invoke for an OnNext notification. |
Action<Exception> | onError | Delegate to invoke for an OnError notification. |
Action | onCompleted | Delegate to invoke for an OnCompleted notification. |
Accept(IObserver<T>)
Invokes the observer's method corresponding to the notification.
Declaration
public abstract void Accept(IObserver<T> observer)
Parameters
Type | Name | Description |
---|---|---|
IObserver<T> | observer | Observer to invoke the notification on. |
Accept<TResult>(Func<T, TResult>, Func<Exception, TResult>, Func<TResult>)
Invokes the delegate corresponding to the notification and returns the produced result.
Declaration
public abstract TResult Accept<TResult>(Func<T, TResult> onNext, Func<Exception, TResult> onError, Func<TResult> onCompleted)
Parameters
Type | Name | Description |
---|---|---|
Func<T, TResult> | onNext | Delegate to invoke for an OnNext notification. |
Func<Exception, TResult> | onError | Delegate to invoke for an OnError notification. |
Func<TResult> | onCompleted | Delegate to invoke for an OnCompleted notification. |
Returns
Type | Description |
---|---|
TResult | Result produced by the observation. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result returned from the notification handler delegates. |
Accept<TResult>(IObserver<T, TResult>)
Invokes the observer's method corresponding to the notification and returns the produced result.
Declaration
public abstract TResult Accept<TResult>(IObserver<T, TResult> observer)
Parameters
Type | Name | Description |
---|---|---|
IObserver<T, TResult> | observer | Observer to invoke the notification on. |
Returns
Type | Description |
---|---|
TResult | Result produced by the observation. |
Type Parameters
Name | Description |
---|---|
TResult | The type of the result returned from the observer's notification handlers. |
Equals(Object)
Determines whether the specified System.Object is equal to the current Notification<T>.
Declaration
public override bool Equals(object obj)
Parameters
Type | Name | Description |
---|---|---|
Object | obj | The System.Object to compare with the current Notification<T>. |
Returns
Type | Description |
---|---|
Boolean | true if the specified System.Object is equal to the current Notification<T>; otherwise, false. |
Overrides
Remarks
Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
Equals(Notification<T>)
Determines whether the current Notification<T> object has the same observer message payload as a specified Notification<T> value.
Declaration
public abstract bool Equals(Notification<T> other)
Parameters
Type | Name | Description |
---|---|---|
Notification<T> | other | An object to compare to the current Notification<T> object. |
Returns
Type | Description |
---|---|
Boolean | true if both Notification<T> objects have the same observer message payload; otherwise, false. |
Remarks
Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
ToObservable()
Returns an observable sequence with a single notification, using the immediate scheduler.
Declaration
public IObservable<T> ToObservable()
Returns
Type | Description |
---|---|
IObservable<T> | The observable sequence that surfaces the behavior of the notification upon subscription. |
ToObservable(IScheduler)
Returns an observable sequence with a single notification.
Declaration
public IObservable<T> ToObservable(IScheduler scheduler)
Parameters
Type | Name | Description |
---|---|---|
IScheduler | scheduler | Scheduler to send out the notification calls on. |
Returns
Type | Description |
---|---|
IObservable<T> | The observable sequence that surfaces the behavior of the notification upon subscription. |
Operators
| Improve this Doc View SourceEquality(Notification<T>, Notification<T>)
Determines whether the two specified Notification<T> objects have the same observer message payload.
Declaration
public static bool operator ==(Notification<T> left, Notification<T> right)
Parameters
Type | Name | Description |
---|---|---|
Notification<T> | left | The first Notification<T> to compare, or null. |
Notification<T> | right | The second Notification<T> to compare, or null. |
Returns
Type | Description |
---|---|
Boolean | true if the first Notification<T> value has the same observer message payload as the second Notification<T> value; otherwise, false. |
Remarks
Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. In case one wants to determine whether two Notification<T> objects represent the same observer method call, use Object.ReferenceEquals identity equality instead.
Inequality(Notification<T>, Notification<T>)
Determines whether the two specified Notification<T> objects have a different observer message payload.
Declaration
public static bool operator !=(Notification<T> left, Notification<T> right)
Parameters
Type | Name | Description |
---|---|---|
Notification<T> | left | The first Notification<T> to compare, or null. |
Notification<T> | right | The second Notification<T> to compare, or null. |
Returns
Type | Description |
---|---|
Boolean | true if the first Notification<T> value has a different observer message payload as the second Notification<T> value; otherwise, false. |
Remarks
Equality of Notification<T> objects is based on the equality of the observer message payload they represent, including the notification Kind and the Value or Exception (if any). This means two Notification<T> objects can be equal even though they don't represent the same observer method call, but have the same Kind and have equal parameters passed to the observer method. In case one wants to determine whether two Notification<T> objects represent a different observer method call, use Object.ReferenceEquals identity equality instead.