Information
The topic you requested is included in another documentation set. For convenience, it's displayed below. Choose Switch to see the topic in its original location.

QueryableExtensions::MaxAsync Method

Entity Framework 6.0
 

Asynchronously returns the maximum value of a sequence.

Namespace:   System.Data.Entity
Assembly:  EntityFramework (in EntityFramework.dll)

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticMaxAsync<TSource>(IQueryable<TSource>^)

Asynchronously returns the maximum value of a sequence.

System_CAPS_pubmethodSystem_CAPS_staticMaxAsync<TSource>(IQueryable<TSource>^, CancellationToken)

Asynchronously returns the maximum value of a sequence.

System_CAPS_pubmethodSystem_CAPS_staticMaxAsync<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_CAPS_pubmethodSystem_CAPS_staticMaxAsync<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.

Return to top

QueryableExtensions::MaxAsync<TSource> Method (IQueryable<TSource>^)

Asynchronously returns the maximum value of a sequence.

public:
generic<typename TSource>
[ExtensionAttribute]
static Task<TSource>^ MaxAsync(
	IQueryable<TSource>^ source
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

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

Return Value

Type: System.Threading.Tasks::Task<TSource>^

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

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

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.

Return to top

QueryableExtensions::MaxAsync<TSource> Method (IQueryable<TSource>^, CancellationToken)

Asynchronously returns the maximum value of a sequence.

public:
generic<typename TSource>
[ExtensionAttribute]
static Task<TSource>^ MaxAsync(
	IQueryable<TSource>^ source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

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

cancellationToken
Type: System.Threading::CancellationToken

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

Return Value

Type: System.Threading.Tasks::Task<TSource>^

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

Type Parameters

TSource

The type of the elements of source.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

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.

Return to top

QueryableExtensions::MaxAsync<TSource, TResult> Method (IQueryable<TSource>^, Expression<Func<TSource, TResult>^>^)

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

public:
generic<typename TSource, typename TResult>
[ExtensionAttribute]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
static Task<TResult>^ MaxAsync(
	IQueryable<TSource>^ source,
	Expression<Func<TSource, TResult>^>^ selector
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

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

selector
Type: System.Linq.Expressions::Expression<Func<TSource, TResult>^>^

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks::Task<TResult>^

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

Type Parameters

TSource

The type of the elements of source.

TResult

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

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

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.

Return to top

QueryableExtensions::MaxAsync<TSource, TResult> Method (IQueryable<TSource>^, Expression<Func<TSource, TResult>^>^, CancellationToken)

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

public:
generic<typename TSource, typename TResult>
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[ExtensionAttribute]
static Task<TResult>^ MaxAsync(
	IQueryable<TSource>^ source,
	Expression<Func<TSource, TResult>^>^ selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq::IQueryable<TSource>^

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

selector
Type: System.Linq.Expressions::Expression<Func<TSource, TResult>^>^

A projection function to apply to each element.

cancellationToken
Type: System.Threading::CancellationToken

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

Return Value

Type: System.Threading.Tasks::Task<TResult>^

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

Type Parameters

TSource

The type of the elements of source.

TResult

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

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

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.

Return to top
Show: