Bagikan melalui


Observable.Buffer<TSource, TBufferOpening, TBufferClosing> Method (IObservable<TSource>, IObservable<TBufferOpening>, Func<TBufferOpening, IObservable<TBufferClosing>>)

Indicates each element of a queryable observable sequence into consecutive non-overlapping buffers.

Namespace:  System.Reactive.Linq
Assembly:  System.Reactive (in System.Reactive.dll)

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function Buffer(Of TSource, TBufferOpening, TBufferClosing) ( _
    source As IObservable(Of TSource), _
    bufferOpenings As IObservable(Of TBufferOpening), _
    bufferClosingSelector As Func(Of TBufferOpening, IObservable(Of TBufferClosing)) _
) As IObservable(Of IList(Of TSource))
'Usage
Dim source As IObservable(Of TSource)
Dim bufferOpenings As IObservable(Of TBufferOpening)
Dim bufferClosingSelector As Func(Of TBufferOpening, IObservable(Of TBufferClosing))
Dim returnValue As IObservable(Of IList(Of TSource))

returnValue = source.Buffer(bufferOpenings, _
    bufferClosingSelector)
public static IObservable<IList<TSource>> Buffer<TSource, TBufferOpening, TBufferClosing>(
    this IObservable<TSource> source,
    IObservable<TBufferOpening> bufferOpenings,
    Func<TBufferOpening, IObservable<TBufferClosing>> bufferClosingSelector
)
[ExtensionAttribute]
public:
generic<typename TSource, typename TBufferOpening, typename TBufferClosing>
static IObservable<IList<TSource>^>^ Buffer(
    IObservable<TSource>^ source, 
    IObservable<TBufferOpening>^ bufferOpenings, 
    Func<TBufferOpening, IObservable<TBufferClosing>^>^ bufferClosingSelector
)
static member Buffer : 
        source:IObservable<'TSource> * 
        bufferOpenings:IObservable<'TBufferOpening> * 
        bufferClosingSelector:Func<'TBufferOpening, IObservable<'TBufferClosing>> -> IObservable<IList<'TSource>> 
JScript does not support generic types and methods.

Type Parameters

  • TSource
    The type of source.
  • TBufferOpening
    The type of observable sequence whose elements denote the opening of each produced buffer.
  • TBufferClosing
    The type of observable sequence whose elements denote the closing of each produced buffer.

Parameters

  • bufferOpenings
    Type: System.IObservable<TBufferOpening>
    The observable sequence whose elements denote the creation of new buffers.
  • bufferClosingSelector
    Type: System.Func<TBufferOpening, IObservable<TBufferClosing>>
    The function invoked to define the closing of each produced buffer.

Return Value

Type: System.IObservable<IList<TSource>>
The observable sequence of buffers.

Usage Note

In Visual Basic and C#, you can call this method as an instance method on any object of type IObservable<TSource>. When you use instance method syntax to call this method, omit the first parameter. For more information, see or .

See Also

Reference

Observable Class

Buffer Overload

System.Reactive.Linq Namespace