共用方式為


Qbservable.Distinct < TSource, TKey > 方法 (IQbservable < TSource > , Expression < Func < TSource, 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)) _
) As IQbservable(Of TSource)
'Usage
Dim source As IQbservable(Of TSource)
Dim keySelector As Expression(Of Func(Of TSource, TKey))
Dim returnValue As IQbservable(Of TSource)

returnValue = source.Distinct(keySelector)
public static IQbservable<TSource> Distinct<TSource, TKey>(
    this IQbservable<TSource> source,
    Expression<Func<TSource, TKey>> keySelector
)
[ExtensionAttribute]
public:
generic<typename TSource, typename TKey>
static IQbservable<TSource>^ Distinct(
    IQbservable<TSource>^ source, 
    Expression<Func<TSource, TKey>^>^ keySelector
)
static member Distinct : 
        source:IQbservable<'TSource> * 
        keySelector:Expression<Func<'TSource, '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 命名空間