Table of Contents

Class Condition

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an expression builder which filters the elements of an observable sequence according to a condition specified by the encapsulated workflow.

Marble diagram

The nested workflow specifying the condition must return a sequence of type bool. This nested sequence may be synchronous or asynchronous with respect to notifications from the source sequence. After each element is emitted by the source sequence, the latest value from the nested sequence is checked. If the value is true then the element will be accepted and emitted by the result sequence. Otherwise, the element will be dropped.

As an example of asynchronous condition evaluation, it is possible to build a simple manual toggle by using a BooleanProperty connected directly to the output of the nested workflow:

Condition with manual toggle

public class Condition : SingleArgumentWorkflowExpressionBuilder, IWorkflowExpressionBuilder, INamedElement, IPropertyMappingBuilder, IExpressionBuilder
Inheritance
Condition
Implements
Derived
Inherited Members
Extension Methods

Constructors

Condition()

Initializes a new instance of the Condition class.

public Condition()

Condition(ExpressionBuilderGraph)

Initializes a new instance of the Condition class with the specified expression builder workflow.

public Condition(ExpressionBuilderGraph workflow)

Parameters

workflow ExpressionBuilderGraph

The expression builder workflow instance that will be used by this builder to generate the output expression tree.

Methods

Build(IEnumerable<Expression>)

Generates an Expression node from a collection of input arguments. The result can be chained with other builders in a workflow.

public override Expression Build(IEnumerable<Expression> arguments)

Parameters

arguments IEnumerable<Expression>

A collection of Expression nodes that represents the input arguments.

Returns

Expression

An Expression tree node.