Table of Contents

Class ToDictionary

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that creates a dictionary from an observable sequence according to the specified key and element selector.

Marble diagram

ToDictionary collects all the values from the source sequence and creates a dictionary mapping keys to elements using the specified KeySelector and ElementSelector properties. The dictionary is emitted when the source sequence completes successfully, and will have key and element types matching the selected members.

Warning

If the source sequence emits a value with a duplicate key, an error will be raised and the sequence will terminate exceptionally.

Warning

If the source sequence is infinite (i.e. does not terminate), this operator will never emit the collection, and will keep accumulating all elements from the source sequence indefinitely, with likely impacts on available memory.

public class ToDictionary : SingleArgumentExpressionBuilder, IExpressionBuilder
Inheritance
ToDictionary
Implements
Inherited Members
Extension Methods

Properties

ElementSelector

Gets or sets a value specifying the inner properties used as elements in the dictionary.

public string ElementSelector { get; set; }

Property Value

string

KeySelector

Gets or sets a value specifying the inner properties used as keys in the dictionary.

public string KeySelector { get; set; }

Property Value

string

Methods

Build(IEnumerable<Expression>)

Constructs 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 representing the input arguments.

Returns

Expression

The constructed Expression node.