共用方式為


Observable.GroupByUntil < TSource, TKey, TElement, TDuration > 方法 (IObservable < TSource, Func < TSource > , TKey > , Func TSource, TElement > , Func << IGroupedObservable TKey, TElement > , IObservable << TDuration >> , IEqualityComparer < TKey >)

根據指定的索引鍵選取器函式和比較子,將可觀察序列的專案分組,並使用指定的函式來選取產生的專案。

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function GroupByUntil(Of TSource, TKey, TElement, TDuration) ( _
    source As IObservable(Of TSource), _
    keySelector As Func(Of TSource, TKey), _
    elementSelector As Func(Of TSource, TElement), _
    durationSelector As Func(Of IGroupedObservable(Of TKey, TElement), IObservable(Of TDuration)), _
    comparer As IEqualityComparer(Of TKey) _
) As IObservable(Of IGroupedObservable(Of TKey, TElement))
'Usage
Dim source As IObservable(Of TSource)
Dim keySelector As Func(Of TSource, TKey)
Dim elementSelector As Func(Of TSource, TElement)
Dim durationSelector As Func(Of IGroupedObservable(Of TKey, TElement), IObservable(Of TDuration))
Dim comparer As IEqualityComparer(Of TKey)
Dim returnValue As IObservable(Of IGroupedObservable(Of TKey, TElement))

returnValue = source.GroupByUntil(keySelector, _
    elementSelector, durationSelector, _
    comparer)
public static IObservable<IGroupedObservable<TKey, TElement>> GroupByUntil<TSource, TKey, TElement, TDuration>(
    this IObservable<TSource> source,
    Func<TSource, TKey> keySelector,
    Func<TSource, TElement> elementSelector,
    Func<IGroupedObservable<TKey, TElement>, IObservable<TDuration>> durationSelector,
    IEqualityComparer<TKey> comparer
)
[ExtensionAttribute]
public:
generic<typename TSource, typename TKey, typename TElement, typename TDuration>
static IObservable<IGroupedObservable<TKey, TElement>^>^ GroupByUntil(
    IObservable<TSource>^ source, 
    Func<TSource, TKey>^ keySelector, 
    Func<TSource, TElement>^ elementSelector, 
    Func<IGroupedObservable<TKey, TElement>^, IObservable<TDuration>^>^ durationSelector, 
    IEqualityComparer<TKey>^ comparer
)
static member GroupByUntil : 
        source:IObservable<'TSource> * 
        keySelector:Func<'TSource, 'TKey> * 
        elementSelector:Func<'TSource, 'TElement> * 
        durationSelector:Func<IGroupedObservable<'TKey, 'TElement>, IObservable<'TDuration>> * 
        comparer:IEqualityComparer<'TKey> -> IObservable<IGroupedObservable<'TKey, 'TElement>> 
JScript does not support generic types and methods.

類型參數

  • TSource
    類型來源。
  • TKey
    類型索引鍵。
  • TElement
    類型專案。
  • TDuration
    類型持續時間。

參數

  • keySelector
    類型:System.Func< TSource、TKey>
    用來擷取各項目之索引鍵的函式。
  • elementSelector
    類型:System.Func< TSource、TElement>
    函式,將每個來源專案對應至可觀察群組中的專案。

傳回值

類型:System.IObservable<IGroupedObservable< TKey、 TElement>>
可觀察群組序列,每個群組都會對應至唯一索引鍵值,其中包含共用相同索引鍵值的所有元素。

使用注意事項

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

另請參閱

參考

Observable 類別

GroupByUntil 多載

System.Reactive.Linq 命名空間