共用方式為


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

傳回可查詢的可觀察序列,這個序列只包含根據 keySelector 和比較子的不同元素。

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

Syntax

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

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

類型參數

  • TSource
    來源的類型。
  • TKey
    索引鍵類型。

參數

傳回值

類型:System.Reactive.Linq.IQbservable< TSource>
可查詢的可觀察序列,只包含來源序列中計算索引鍵值的相異專案。

使用注意事項

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

另請參閱

參考

Qbservable 類別

相異多載

System.Reactive.Linq 命名空間