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
sourceIObservable<TSource>The observable sequence to filter.
intervalTimeSpanThe 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
sourcesequence will be allowed through.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.
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
sourceIObservable<TSource>The observable sequence to filter.
intervalTimeSpanThe time interval after which a new element of the sequence is allowed to pass through the gate.
schedulerISchedulerThe 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
sourcesequence will be allowed through.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.
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
sourceIObservable<TSource>The observable sequence to filter.
gateOpeningsIObservable<TGateOpening>The sequence of gate opening events.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpeningssequence produces a notification, the next element from thesourcesequence will be allowed through.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.TGateOpeningThe type of the elements in the
gateOpeningssequence.
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
sourceIObservable<TSource>The observable sequence to filter.
gateOpeningsIObservable<TGateOpening>The sequence of gate opening events.
dueTimeTimeSpanAfter 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
gateOpeningssequence produces a notification, the next element from thesourcesequence will be allowed through if it is emitted before the specified due time elapses.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.TGateOpeningThe type of the elements in the
gateOpeningssequence.
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
sourceIObservable<TSource>The observable sequence to filter.
gateOpeningsIObservable<TGateOpening>The sequence of gate opening events.
dueTimeTimeSpanAfter 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.
schedulerISchedulerThe scheduler to run the gate closing timer on.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpeningssequence produces a notification, the next element from thesourcesequence will be allowed through if it is emitted before the specified due time elapses.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.TGateOpeningThe type of the elements in the
gateOpeningssequence.
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
sourceIObservable<TSource>The observable sequence to filter.
gateOpeningsIObservable<TGateOpening>The sequence of gate opening events.
gateClosingsIObservable<TGateClosing>The sequence of gate closing events.
Returns
- IObservable<TSource>
The filtered observable sequence. Every time the
gateOpeningssequence produces a notification, the next element from thesourcesequence will be allowed through if it is emitted before the next notification from thegateClosingssequence.
Type Parameters
TSourceThe type of the elements in the
sourcesequence.TGateOpeningThe type of the elements in the
gateOpeningssequence.TGateClosingThe type of the elements in the
gateClosingssequence.