Table of Contents

Class ResourceSubject

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder that stores and broadcasts the last disposable value of an observable sequence to all subscribed and future observers. The value is disposed when the containing context is closed.

Marble diagram

ResourceSubject stores and passes the single 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 values, ResourceSubject will also complete without emitting any values.

Warning

The type of the stored value must be IDisposable. When the enclosing workflow scope is terminated, the value will be disposed to free any allocated resources, such as file or memory handles.

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

[WorkflowElementIcon("ResourceSubject")]
public class ResourceSubject : SubjectBuilder, IExpressionBuilder, INamedElement
Inheritance
ResourceSubject
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.