ParallelEnumerable.ElementAtOrDefault<TSource> 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
如果索引范围不足,则返回并行序列中指定索引处的元素或默认值。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static TSource ElementAtOrDefault(System::Linq::ParallelQuery<TSource> ^ source, int index);
public static TSource ElementAtOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, int index);
public static TSource? ElementAtOrDefault<TSource>(this System.Linq.ParallelQuery<TSource> source, int index);
static member ElementAtOrDefault : System.Linq.ParallelQuery<'Source> * int -> 'Source
<Extension()>
Public Function ElementAtOrDefault(Of TSource) (source As ParallelQuery(Of TSource), index As Integer) As TSource
类型参数
- TSource
的元素 source的类型。
参数
- source
- ParallelQuery<TSource>
要从中返回元素的序列。
- index
- Int32
要检索的元素的从零开始的索引。
返回
TSource
如果索引超出源序列的边界,则默认值为 ;如果索引超出源序列的边界,则为 default(TSource);否则,源序列中位于指定位置的元素。
例外
source 是空引用(Visual Basic 中没有任何内容)。
在查询评估期间发生一个或多个异常。