Method Gate
- Namespace
- Bonsai
- Assembly
- Bonsai.Core.dll
Gate<TSource>(IObservable<TSource>, TimeSpan)
Allows a single element from an observable sequence to pass through every time the specified time interval elapses.
public static IObservable<TSource> Gate<TSource>(this IObservable<TSource> source, TimeSpan interval)
Parameters
source
IObservable<TSource>The observable sequence to filter.
interval
TimeSpanThe time interval after which a new element of the sequence is allowed to pass through the gate.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the specified time interval elapses, the next element from the
source
sequence will be allowed through.
Type Parameters
TSource
The type of the elements in the
source
sequence.
Gate<TSource>(IObservable<TSource>, TimeSpan, IScheduler)
Allows a single element from an observable sequence to pass through every time the specified time interval elapses, using the specified scheduler to run gate timers.
public static IObservable<TSource> Gate<TSource>(this IObservable<TSource> source, TimeSpan interval, IScheduler scheduler)
Parameters
source
IObservable<TSource>The observable sequence to filter.
interval
TimeSpanThe time interval after which a new element of the sequence is allowed to pass through the gate.
scheduler
ISchedulerThe scheduler to run the gate timer on.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the specified time interval elapses, the next element from the
source
sequence will be allowed through.
Type Parameters
TSource
The type of the elements in the
source
sequence.
Gate<TSource, TGateOpening>(IObservable<TSource>, IObservable<TGateOpening>)
Allows a single element from an observable sequence to pass through every time a second sequence emits a notification.
public static IObservable<TSource> Gate<TSource, TGateOpening>(this IObservable<TSource> source, IObservable<TGateOpening> gateOpenings)
Parameters
source
IObservable<TSource>The observable sequence to filter.
gateOpenings
IObservable<TGateOpening>The sequence of gate opening events.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpenings
sequence produces a notification, the next element from thesource
sequence will be allowed through.
Type Parameters
TSource
The type of the elements in the
source
sequence.TGateOpening
The type of the elements in the
gateOpenings
sequence.
Gate<TSource, TGateOpening>(IObservable<TSource>, IObservable<TGateOpening>, TimeSpan)
Allows an element from an observable sequence to pass through if this element is produced after a gate opening event and before the specified due time elapses.
public static IObservable<TSource> Gate<TSource, TGateOpening>(this IObservable<TSource> source, IObservable<TGateOpening> gateOpenings, TimeSpan dueTime)
Parameters
source
IObservable<TSource>The observable sequence to filter.
gateOpenings
IObservable<TGateOpening>The sequence of gate opening events.
dueTime
TimeSpanAfter receiving a gate event, the maximum time that can elapse before an element from the source sequence is produced. If the element arrives after the due time elapses, that element is dropped from the result sequence.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpenings
sequence produces a notification, the next element from thesource
sequence will be allowed through if it is emitted before the specified due time elapses.
Type Parameters
TSource
The type of the elements in the
source
sequence.TGateOpening
The type of the elements in the
gateOpenings
sequence.
Gate<TSource, TGateOpening>(IObservable<TSource>, IObservable<TGateOpening>, TimeSpan, IScheduler)
Allows an element from an observable sequence to pass through if this element is produced after a gate opening event and before the specified due time elapses, using the specified scheduler to run gate closing timers.
public static IObservable<TSource> Gate<TSource, TGateOpening>(this IObservable<TSource> source, IObservable<TGateOpening> gateOpenings, TimeSpan dueTime, IScheduler scheduler)
Parameters
source
IObservable<TSource>The observable sequence to filter.
gateOpenings
IObservable<TGateOpening>The sequence of gate opening events.
dueTime
TimeSpanAfter receiving a gate event, the maximum time that can elapse before an element from the source sequence is produced. If the element arrives after the due time elapses, that element is dropped from the result sequence.
scheduler
ISchedulerThe scheduler to run the gate closing timer on.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpenings
sequence produces a notification, the next element from thesource
sequence will be allowed through if it is emitted before the specified due time elapses.
Type Parameters
TSource
The type of the elements in the
source
sequence.TGateOpening
The type of the elements in the
gateOpenings
sequence.
Gate<TSource, TGateOpening, TGateClosing>(IObservable<TSource>, IObservable<TGateOpening>, IObservable<TGateClosing>)
Allows an element from an observable sequence to pass through if this element is produced between a gate opening and gate closing event.
public static IObservable<TSource> Gate<TSource, TGateOpening, TGateClosing>(this IObservable<TSource> source, IObservable<TGateOpening> gateOpenings, IObservable<TGateClosing> gateClosings)
Parameters
source
IObservable<TSource>The observable sequence to filter.
gateOpenings
IObservable<TGateOpening>The sequence of gate opening events.
gateClosings
IObservable<TGateClosing>The sequence of gate closing events.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpenings
sequence produces a notification, the next element from thesource
sequence will be allowed through if it is emitted before the next notification from thegateClosings
sequence.
Type Parameters
TSource
The type of the elements in the
source
sequence.TGateOpening
The type of the elements in the
gateOpenings
sequence.TGateClosing
The type of the elements in the
gateClosings
sequence.