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
項目的型別。
參數
- source
類型:System.Reactive.Linq.IQbservable< TSource>
要為其建立字典的可查詢可觀察序列。
- keySelector
類型:System.Linq.Expressions.Expression<Func< TSource、 TKey>>
用來從各個項目擷取索引鍵的函式。
- elementSelector
類型:System.Linq.Expressions.Expression<Func< TSource、TElement>>
用來從每個項目產生結果項目值的轉換函式。
- 比較
類型:System.Collections.Generic.IEqualityComparer< TKey>
要比較索引鍵的相等比較子。
傳回值
類型:System.Reactive.Linq.IQbservable<IDictionary< TKey、 TElement>>
根據指定的索引鍵選取器函式、比較子和元素選取器函式,從可查詢的可觀察序列字典。
使用注意事項
在 Visual Basic 和 C# 中,您可以在IQbservable< TSource > 類型的任何物件上呼叫此方法作為實例方法。 使用執行個體方法語法呼叫這個方法時,請省略第一個參數。 如需詳細資訊,請參閱 或 。