Table of Contents

Class BehaviorSubject<T>

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder that broadcasts the latest value from other observable sequences to all subscribed and future observers.

Marble diagram

BehaviorSubject stores and passes the latest value emitted by the source sequence to each subscribed observer, and then continues to emit any subsequent values.

Any observers which subscribe later will immediately receive the latest stored value. However, if the source sequence terminates with an error, BehaviorSubject will not emit any values but will pass along the error notification to all subsequent observers.

Warning

BehaviorSubject is designed to multicast and share state updates from multiple sources, like a global variable. Because of this, even if one of the source sequences emitting values to BehaviorSubject terminates successfully, the BehaviorSubject will not send a termination message to any subscribed observers, but will remain active until the enclosing workflow scope is terminated to allow other sources to update the shared state.

[WorkflowElementIcon("BehaviorSubject")]
public class BehaviorSubject<T> : SubjectBuilder<T>, IExpressionBuilder, INamedElement

Type Parameters

T

The type of the elements processed by the subject.

Inheritance
BehaviorSubject<T>
Implements
Inherited Members
Extension Methods

Methods

CreateSubject()

Creates a shared subject that broadcasts the latest value from other observable sequences to all subscribed and future observers.

protected override ISubject<T> CreateSubject()

Returns

ISubject<T>

A new instance of ISubject<T>.