Share via


QueryableExtensions.MaxAsync Method

Definition

Overloads

MaxAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>)

Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value.

MaxAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken)

Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value.

MaxAsync<TSource>(IQueryable<TSource>)

Asynchronously returns the maximum value of a sequence.

MaxAsync<TSource>(IQueryable<TSource>, CancellationToken)

Asynchronously returns the maximum value of a sequence.

MaxAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>)

Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<TResult> MaxAsync<TSource,TResult> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TResult>> selector);
static member MaxAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Result>> -> System.Threading.Tasks.Task<'Result>
<Extension()>
Public Function MaxAsync(Of TSource, TResult) (source As IQueryable(Of TSource), selector As Expression(Of Func(Of TSource, TResult))) As Task(Of TResult)

Type Parameters

TSource

The type of the elements of source.

TResult

The type of the value returned by the function represented by selector .

Parameters

source
IQueryable<TSource>

An IQueryable<T> that contains the elements to determine the maximum of.

selector
Expression<Func<TSource,TResult>>

A projection function to apply to each element.

Returns

Task<TResult>

A task that represents the asynchronous operation. The task result contains the maximum value in the sequence.

Attributes

Exceptions

source or selector is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

MaxAsync<TSource,TResult>(IQueryable<TSource>, Expression<Func<TSource,TResult>>, CancellationToken)

Asynchronously invokes a projection function on each element of a sequence and returns the maximum resulting value.

[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static System.Threading.Tasks.Task<TResult> MaxAsync<TSource,TResult> (this System.Linq.IQueryable<TSource> source, System.Linq.Expressions.Expression<Func<TSource,TResult>> selector, System.Threading.CancellationToken cancellationToken);
static member MaxAsync : System.Linq.IQueryable<'Source> * System.Linq.Expressions.Expression<Func<'Source, 'Result>> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Result>

Type Parameters

TSource

The type of the elements of source.

TResult

The type of the value returned by the function represented by selector .

Parameters

source
IQueryable<TSource>

An IQueryable<T> that contains the elements to determine the maximum of.

selector
Expression<Func<TSource,TResult>>

A projection function to apply to each element.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<TResult>

A task that represents the asynchronous operation. The task result contains the maximum value in the sequence.

Attributes

Exceptions

source or selector is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

MaxAsync<TSource>(IQueryable<TSource>)

Asynchronously returns the maximum value of a sequence.

public static System.Threading.Tasks.Task<TSource> MaxAsync<TSource> (this System.Linq.IQueryable<TSource> source);
static member MaxAsync : System.Linq.IQueryable<'Source> -> System.Threading.Tasks.Task<'Source>
<Extension()>
Public Function MaxAsync(Of TSource) (source As IQueryable(Of TSource)) As Task(Of TSource)

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> that contains the elements to determine the maximum of.

Returns

Task<TSource>

A task that represents the asynchronous operation. The task result contains the maximum value in the sequence.

Exceptions

source is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to

MaxAsync<TSource>(IQueryable<TSource>, CancellationToken)

Asynchronously returns the maximum value of a sequence.

public static System.Threading.Tasks.Task<TSource> MaxAsync<TSource> (this System.Linq.IQueryable<TSource> source, System.Threading.CancellationToken cancellationToken);
static member MaxAsync : System.Linq.IQueryable<'Source> * System.Threading.CancellationToken -> System.Threading.Tasks.Task<'Source>

Type Parameters

TSource

The type of the elements of source.

Parameters

source
IQueryable<TSource>

An IQueryable<T> that contains the elements to determine the maximum of.

cancellationToken
CancellationToken

A CancellationToken to observe while waiting for the task to complete.

Returns

Task<TSource>

A task that represents the asynchronous operation. The task result contains the maximum value in the sequence.

Exceptions

source is null .

Remarks

Multiple active operations on the same context instance are not supported. Use 'await' to ensure that any asynchronous operations have completed before calling another method on this context.

Applies to