AsyncEnumerable.DefaultIfEmpty 方法
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
重载
| 名称 | 说明 |
|---|---|
| DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>) |
如果序列为空,则返回指定序列的元素或类型参数的默认值。 |
| DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource) |
如果序列为空,则返回指定序列的元素或指定值。 |
DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>)
- Source:
- DefaultIfEmpty.cs
- Source:
- DefaultIfEmpty.cs
- Source:
- DefaultIfEmpty.cs
如果序列为空,则返回指定序列的元素或类型参数的默认值。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IAsyncEnumerable<TSource> ^ DefaultIfEmpty(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source);
public static System.Collections.Generic.IAsyncEnumerable<TSource?> DefaultIfEmpty<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source);
static member DefaultIfEmpty : System.Collections.Generic.IAsyncEnumerable<'Source> -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As IAsyncEnumerable(Of TSource)) As IAsyncEnumerable(Of TSource)
类型参数
- TSource
源元素的类型。
参数
- source
- IAsyncEnumerable<TSource>
返回默认值的序列(如果为空)。
返回
IAsyncEnumerable<TSource>
如果 IAsyncEnumerable<T> 源为空,则包含 TSource 类型的默认值的对象;否则为 source。
例外
source 是 null。
适用于
DefaultIfEmpty<TSource>(IAsyncEnumerable<TSource>, TSource)
- Source:
- DefaultIfEmpty.cs
- Source:
- DefaultIfEmpty.cs
- Source:
- DefaultIfEmpty.cs
如果序列为空,则返回指定序列的元素或指定值。
public:
generic <typename TSource>
[System::Runtime::CompilerServices::Extension]
static System::Collections::Generic::IAsyncEnumerable<TSource> ^ DefaultIfEmpty(System::Collections::Generic::IAsyncEnumerable<TSource> ^ source, TSource defaultValue);
public static System.Collections.Generic.IAsyncEnumerable<TSource> DefaultIfEmpty<TSource>(this System.Collections.Generic.IAsyncEnumerable<TSource> source, TSource defaultValue);
static member DefaultIfEmpty : System.Collections.Generic.IAsyncEnumerable<'Source> * 'Source -> System.Collections.Generic.IAsyncEnumerable<'Source>
<Extension()>
Public Function DefaultIfEmpty(Of TSource) (source As IAsyncEnumerable(Of TSource), defaultValue As TSource) As IAsyncEnumerable(Of TSource)
类型参数
- TSource
源元素的类型。
参数
- source
- IAsyncEnumerable<TSource>
返回默认值的序列(如果为空)。
- defaultValue
- TSource
如果序列为空,则返回的值。
返回
IAsyncEnumerable<TSource>
如果 IAsyncEnumerable<T> 源为空,则包含 TSource 类型的默认值的对象;否则为 source。
例外
source 是 null。