共用方式為


Qbservable.ToDictionary < TSource, TKey, TElement > 方法 (IQbservable < TSource > , Expression Func TSource, TKey, Expression << Func << TSource, TElement >> , IEqualityComparer < TKey >>>)

根據指定的索引鍵選取器函式、比較子和元素選取器函式,從可查詢的可觀察序列建立字典。

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

Syntax

'Declaration
<ExtensionAttribute> _
Public Shared Function ToDictionary(Of TSource, TKey, TElement) ( _
    source As IQbservable(Of TSource), _
    keySelector As Expression(Of Func(Of TSource, TKey)), _
    elementSelector As Expression(Of Func(Of TSource, TElement)), _
    comparer As IEqualityComparer(Of TKey) _
) As IQbservable(Of IDictionary(Of TKey, TElement))
'Usage
Dim source As IQbservable(Of TSource)
Dim keySelector As Expression(Of Func(Of TSource, TKey))
Dim elementSelector As Expression(Of Func(Of TSource, TElement))
Dim comparer As IEqualityComparer(Of TKey)
Dim returnValue As IQbservable(Of IDictionary(Of TKey, TElement))

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

類型參數

  • TSource
    來源的類型。
  • TKey
    索引鍵類型。
  • TElement
    項目的型別。

參數

傳回值

類型:System.Reactive.Linq.IQbservable<IDictionary< TKey、 TElement>>
根據指定的索引鍵選取器函式、比較子和元素選取器函式,從可查詢的可觀察序列字典。

使用注意事項

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

另請參閱

參考

Qbservable 類別

ToDictionary 多載

System.Reactive.Linq 命名空間