ParallelEnumerable.Contains 方法
定义
并行确定序列是否包含指定的元素。Determines in parallel whether a sequence contains a specified element.
重载
Contains<TSource>(ParallelQuery<TSource>, TSource, IEqualityComparer<TSource>) |
通过使用指定的 IEqualityComparer<T> 来并行确定序列是否包含指定的元素。Determines in parallel whether a sequence contains a specified element by using a specified IEqualityComparer<T>. |
Contains<TSource>(ParallelQuery<TSource>, TSource) |
通过使用默认的相等比较器,并行确定某个序列是否包含指定的元素。Determines in parallel whether a sequence contains a specified element by using the default equality comparer. |
Contains<TSource>(ParallelQuery<TSource>, TSource, IEqualityComparer<TSource>)
通过使用指定的 IEqualityComparer<T> 来并行确定序列是否包含指定的元素。Determines in parallel whether a sequence contains a specified element by using a specified IEqualityComparer<T>.
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static bool Contains(System::Linq::ParallelQuery<TSource> ^ source, TSource value, System::Collections::Generic::IEqualityComparer<TSource> ^ comparer);
public static bool Contains<TSource> (this System.Linq.ParallelQuery<TSource> source, TSource value, System.Collections.Generic.IEqualityComparer<TSource> comparer);
public static bool Contains<TSource> (this System.Linq.ParallelQuery<TSource> source, TSource value, System.Collections.Generic.IEqualityComparer<TSource>? comparer);
static member Contains : System.Linq.ParallelQuery<'Source> * 'Source * System.Collections.Generic.IEqualityComparer<'Source> -> bool
<Extension()>
Public Function Contains(Of TSource) (source As ParallelQuery(Of TSource), value As TSource, comparer As IEqualityComparer(Of TSource)) As Boolean
类型参数
- TSource
source
的元素类型。The type of elements of source
.
参数
- source
- ParallelQuery<TSource>
要在其中定位某个值的序列。A sequence in which to locate a value.
- value
- TSource
要在序列中定位的值。The value to locate in the sequence.
- comparer
- IEqualityComparer<TSource>
一个对值进行比较的相等比较器。An equality comparer to compare values.
返回
如果源序列包含具有指定值的元素,则为 true
;否则为 false
。true
if the source sequence contains an element that has the specified value; otherwise, false
.
例外
已使用通过 WithCancellation
传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation
.
source
为 null 引用(在 Visual Basic 中为 Nothing)。source
is a null reference (Nothing in Visual Basic).
评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.
另请参阅
适用于
Contains<TSource>(ParallelQuery<TSource>, TSource)
通过使用默认的相等比较器,并行确定某个序列是否包含指定的元素。Determines in parallel whether a sequence contains a specified element by using the default equality comparer.
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static bool Contains(System::Linq::ParallelQuery<TSource> ^ source, TSource value);
public static bool Contains<TSource> (this System.Linq.ParallelQuery<TSource> source, TSource value);
static member Contains : System.Linq.ParallelQuery<'Source> * 'Source -> bool
<Extension()>
Public Function Contains(Of TSource) (source As ParallelQuery(Of TSource), value As TSource) As Boolean
类型参数
- TSource
source
的元素类型。The type of elements of source
.
参数
- source
- ParallelQuery<TSource>
要在其中定位某个值的序列。A sequence in which to locate a value.
- value
- TSource
要在序列中定位的值。The value to locate in the sequence.
返回
如果源序列包含具有指定值的元素,则为 true
;否则为 false
。true
if the source sequence contains an element that has the specified value; otherwise, false
.
例外
已使用通过 WithCancellation
传递的令牌取消了查询。The query was canceled with the token passed in through WithCancellation
.
source
为 null 引用(在 Visual Basic 中为 Nothing)。source
is a null reference (Nothing in Visual Basic).
评估查询期间发生一个或多个异常。One or more exceptions occurred during the evaluation of the query.