Table of Contents

Class TaskExtensions

Namespace
Savvyio
Assembly
Savvyio.Core.dll

Extension methods for the System.Threading.Tasks.Task<TResult> class.

public static class TaskExtensions
Inheritance
Object
TaskExtensions

Methods

SingleOrDefaultAsync<T>(Task<IEnumerable<T>>)

Asynchronously returns the only element of a sequence, or a default value if the sequence is empty; this method throws an exception if there is more than one element in the sequence.

public static async Task<T> SingleOrDefaultAsync<T>(this Task<IEnumerable<T>> source)

Parameters

source Task<IEnumerable<T>>

The System.Threading.Tasks.Task<TResult> to return the single element of.

Returns

Task<T>

A task that represents the asynchronous operation. The task result contains the single element of the input sequence, or default (TSource) if the sequence contains no elements.

Type Parameters

T

The type of the elements of source.