共用方式為


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

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

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

Syntax

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

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

類型參數

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

參數

  • keySelector
    類型:System.Func< TSource、TKey>
    用來擷取各項目之索引鍵的函式。

傳回值

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

使用注意事項

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

另請參閱

參考

Observable 類別

GroupByUntil 多載

System.Reactive.Linq 命名空間