Table of Contents

Struct Notification<T>

Namespace
RxSharp
Assembly
RxSharp.dll

A materialized next/error/complete notification, represented as a plain, inert value instead of a live callback invocation. Produced by Materialize<T>(Observable<T>) (which turns a stream's notifications into Notification<T> values flowing through the stream, so e.g. an error becomes a value rather than terminating the stream) and consumed by Dematerialize<T>(Observable<Notification<T>>) (which converts them back).

public readonly struct Notification<T> : IEquatable<Notification<T>>

Type Parameters

T

The type of value carried by a Next notification.

Implements
IEquatable<Notification<T>>

Remarks

This lives in the main RxSharp namespace, not RxSharp.Testing, since materialize/dematerialize are core operators rather than test-only utilities. RxSharp.Testing has a superficially similar type, Recorded<T>, but that type also carries a VirtualTimeScheduler clock timestamp that has no meaning here, and core types should not depend on the testing namespace — so this is a separate, deliberately simpler type rather than a reuse of Recorded<T>.

Properties

Error

Gets the error, for a Error notification; otherwise null.

public Exception? Error { get; }

Property Value

Exception?

Kind

Gets which kind of notification this is.

public NotificationKind Kind { get; }

Property Value

NotificationKind

Value

Gets the emitted value, for a Next notification; otherwise the default value.

public T? Value { get; }

Property Value

T

Methods

Accept(IObserver<T>)

Applies this notification to observer by invoking the matching IObserver<T> method.

public void Accept(IObserver<T> observer)

Parameters

observer IObserver<T>

The observer to notify.

Equals(Notification<T>)

Determines whether this notification matches another (errors compare by type and message, not reference).

public bool Equals(Notification<T> other)

Parameters

other Notification<T>

The notification to compare against.

Returns

bool

true if the two notifications match.

Equals(object?)

public override bool Equals(object? obj)

Parameters

obj object?

Returns

bool

GetHashCode()

public override int GetHashCode()

Returns

int

ToString()

public override string ToString()

Returns

string