Table of Contents

Class Slice

Namespace
Bonsai.Reactive
Assembly
Bonsai.Core.dll

Represents an operator that extracts a range of elements from an observable sequence.

Marble diagram

The Slice operator specifies an index-based filter over elements of the source sequence. Elements from the source sequence are accepted if their index is: greater than or equal to Start; less than Stop, or the stop index property is not specified; not set to be skipped by the Step property.

Warning

If the index of elements in the source sequence becomes greater than or equal to Stop, then Slice will terminate successfully and cancel the subscription to the source sequence.

public class Slice : Combinator
Inheritance
Slice
Inherited Members

Properties

Start

Gets or sets the element index at which the slice begins.

public int Start { get; set; }

Property Value

int

Step

Gets or sets the number of elements to skip between slice elements.

public int Step { get; set; }

Property Value

int

Stop

Gets or sets the element index at which the slice ends. If no value is specified, elements will be taken until the end of the sequence.

public int? Stop { get; set; }

Property Value

int?

Methods

Process<TSource>(IObservable<TSource>)

Extracts a range of elements from an observable sequence.

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

Parameters

source IObservable<TSource>

The source sequence to slice.

Returns

IObservable<TSource>

The sliced sequence.

Type Parameters

TSource

The type of the elements in the source sequence.