Table of Contents

Class RepeatCount

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that repeats an observable sequence a specified number of times.

Marble diagram

RepeatCount reacts to successful termination by disposing the previous subscription and resubscribing to the source sequence, up to the maximum number of times specified in the Count property. Value notifications received from all of the subscriptions are forwarded to the result sequence.

After the source sequence completes successfully the specified number of times, the result sequence will also terminate successfully. If any of the subscriptions terminates exceptionally, the result sequence will also terminate exceptionally, and no further resubscriptions will be made.

Tip

The subscription side-effects (e.g. opening a file, initializing hardware connections) of all upstream operators will be repeated upon termination and resubscription to the source sequence. Sometimes this may be undesirable. For example logging side-effects introduced by Sink nodes may create extra files on each subscription. To shield operators from these effects, consider moving affected operators downstream from the resubscription operator, or moving the resubscription operator itself further upstream.

Caution

All resubscription operators should be applied with care to anonymous branch points in the workflow, since dangling branches operate independently from each other, and from the subscription to the source sequence. For more details, see Subjects.

public class RepeatCount : Combinator
Inheritance
RepeatCount
Inherited Members

Properties

Count

Gets or sets the number of times to repeat the sequence.

public int Count { get; set; }

Property Value

int

Methods

Process<TSource>(IObservable<TSource>)

Repeats the observable sequence a specified number of times.

public override IObservable<TSource> Process<TSource>(IObservable<TSource> source)

Parameters

source IObservable<TSource>

The observable sequence to repeat.

Returns

IObservable<TSource>

The observable sequence producing the elements of the given sequence repeatedly.

Type Parameters

TSource

The type of the elements in the source sequence.