Table of Contents

Class AsyncSubject

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder that broadcasts the last value of an observable sequence to all subscribed and future observers using a shared subject.

Marble diagram

AsyncSubject stores and passes the last value (and only the last value) emitted by the source sequence to each subscribed observer. The value is also only sent out after the source sequence terminates. If the source sequence does not emit any value, AsyncSubject will also terminate without emitting any values.

Tip

You can use the Take operator before AsyncSubject to store the first value from an infinite sequence.

Any observers which subscribe after the source sequence terminates will immediately receive the stored value. If the source sequence terminates with an error, AsyncSubject will not emit any values but will pass along the error notification to all observers.

[WorkflowElementIcon("AsyncSubject")]
public class AsyncSubject : SubjectBuilder, IExpressionBuilder, INamedElement
Inheritance
AsyncSubject
Implements
Inherited Members
Extension Methods

Methods

BuildSubject(Expression)

When overridden in a derived class, returns the expression that creates the shared subject.

protected override Expression BuildSubject(Expression expression)

Parameters

expression Expression

The expression representing the observable input sequence.

Returns

Expression

The Expression that creates the shared subject.