Table of Contents

Class UnitBuilder

Namespace
Bonsai.Expressions
Assembly
Bonsai.Core.dll

Represents an expression builder that generates a sequence of Unit elements.

The Unit operator generates a sequence returning the singleton unit object, if no input sequence is provided. Otherwise, it will convert all elements in the source sequence to the Unit type.

Tip

Unit is most commonly used for converting separate branches with different types into a common type signature, so they can be combined using control flow operators such as Merge or Concat.

[WorkflowElementCategory(ElementCategory.Source)]
public class UnitBuilder : ExpressionBuilder, IExpressionBuilder
Inheritance
UnitBuilder
Implements
Inherited Members
Extension Methods

Remarks

This expression builder generates its elements by either returning the single default Unit instance if no input sequence is provided; or applying a selector on the elements of the source sequence that will convert each input element into the default Unit instance.

Properties

ArgumentRange

Gets the range of input arguments that this expression builder accepts.

public override Range<int> ArgumentRange { get; }

Property Value

Range<int>

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.