共用方式為


Observable.Buffer < TSource、TBufferOpening、TBufferClosing > 方法 (IObservable < TSource > 、IObservable < TBufferOpening、Func < TBufferOpening > 、IObservable < TBufferClosing >>)

將可查詢的可觀察序列的每個元素指出為連續的非重迭緩衝區。

Namespace:System.Reactive.Linq
裝配: System.Reactive.dll) 中的 System.Reactive (

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.

類型參數

  • TSource
    來源的類型。
  • TBufferOpening
    可觀察序列的類型,其元素代表每個產生的緩衝區的開頭。
  • TBufferClosing
    可觀察序列的類型,其元素表示每個產生的緩衝區的結尾。

參數

  • bufferOpenings
    類型:System.IObservable< TBufferOpening>
    可觀察的序列,其元素表示新緩衝區的建立。
  • bufferClosingSelector
    類型:System.Func< TBufferOpening、IObservable< TBufferClosing>>
    叫用以定義每個產生的緩衝區結尾的函式。

傳回值

類型:System.IObservable<IList< TSource>>
可觀察的緩衝區序列。

使用注意事項

在 Visual Basic 和 C# 中,您可以在IObservable< TSource > 類型的任何物件上呼叫此方法作為實例方法。 使用執行個體方法語法呼叫這個方法時,請省略第一個參數。 如需詳細資訊,請參閱

另請參閱

參考

Observable 類別

緩衝區多載

System.Reactive.Linq 命名空間