QueryableExtensions.AverageAsync Method

 

Asynchronously computes the average of a sequence of Decimal values.

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

NameDescription
System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Decimal>)

Asynchronously computes the average of a sequence of Decimal values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Decimal>, CancellationToken)

Asynchronously computes the average of a sequence of Decimal values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Double>)

Asynchronously computes the average of a sequence of Double values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Double>, CancellationToken)

Asynchronously computes the average of a sequence of Double values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Int32>)

Asynchronously computes the average of a sequence of Int32 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Int32>, CancellationToken)

Asynchronously computes the average of a sequence of Int32 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Int64>)

Asynchronously computes the average of a sequence of Int64 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Int64>, CancellationToken)

Asynchronously computes the average of a sequence of Int64 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Decimal>>)

Asynchronously computes the average of a sequence of nullable Decimal values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Decimal>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Decimal values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Double>>)

Asynchronously computes the average of a sequence of nullable Double values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Double>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Double values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Int32>>)

Asynchronously computes the average of a sequence of nullable Int32 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Int32>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int32 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Int64>>)

Asynchronously computes the average of a sequence of nullable Int64 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Int64>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int64 values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Single>>)

Asynchronously computes the average of a sequence of nullable Single values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Nullable<Single>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Single values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Single>)

Asynchronously computes the average of a sequence of Single values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync(IQueryable<Single>, CancellationToken)

Asynchronously computes the average of a sequence of Single values.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Decimal>>)

Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Decimal>>, CancellationToken)

Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Double>>)

Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Double>>, CancellationToken)

Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int32>>)

Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int32>>, CancellationToken)

Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int64>>)

Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Int64>>, CancellationToken)

Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>)

Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>)

Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>)

Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>)

Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>)

Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Single>>)

Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.

System_CAPS_pubmethodSystem_CAPS_staticAverageAsync<TSource>(IQueryable<TSource>, Expression<Func<TSource, Single>>, CancellationToken)

Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.


QueryableExtensions.AverageAsync Method (IQueryable<Decimal>)

Asynchronously computes the average of a sequence of Decimal values.

public static Task<decimal> AverageAsync(
	this IQueryable<decimal> source
)

Parameters

source
Type: System.Linq.IQueryable<Decimal>

A sequence of Decimal values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Decimal>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Decimal>, CancellationToken)

Asynchronously computes the average of a sequence of Decimal values.

public static Task<decimal> AverageAsync(
	this IQueryable<decimal> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Decimal>

A sequence of Decimal values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Decimal>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Double>)

Asynchronously computes the average of a sequence of Double values.

public static Task<double> AverageAsync(
	this IQueryable<double> source
)

Parameters

source
Type: System.Linq.IQueryable<Double>

A sequence of Double values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Double>, CancellationToken)

Asynchronously computes the average of a sequence of Double values.

public static Task<double> AverageAsync(
	this IQueryable<double> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Double>

A sequence of Double values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Int32>)

Asynchronously computes the average of a sequence of Int32 values.

public static Task<double> AverageAsync(
	this IQueryable<int> source
)

Parameters

source
Type: System.Linq.IQueryable<Int32>

A sequence of Int32 values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Int32>, CancellationToken)

Asynchronously computes the average of a sequence of Int32 values.

public static Task<double> AverageAsync(
	this IQueryable<int> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Int32>

A sequence of Int32 values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Int64>)

Asynchronously computes the average of a sequence of Int64 values.

public static Task<double> AverageAsync(
	this IQueryable<long> source
)

Parameters

source
Type: System.Linq.IQueryable<Int64>

A sequence of Int64 values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Int64>, CancellationToken)

Asynchronously computes the average of a sequence of Int64 values.

public static Task<double> AverageAsync(
	this IQueryable<long> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Int64>

A sequence of Int64 values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Decimal>>)

Asynchronously computes the average of a sequence of nullable Decimal values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<decimal>> AverageAsync(
	this IQueryable<Nullable<decimal>> source
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Decimal>>

A sequence of nullable Decimal values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Decimal>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Decimal>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Decimal values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<decimal>> AverageAsync(
	this IQueryable<Nullable<decimal>> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Decimal>>

A sequence of nullable Decimal values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Nullable<Decimal>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Double>>)

Asynchronously computes the average of a sequence of nullable Double values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<double>> source
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Double>>

A sequence of nullable Double values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Double>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Double values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<double>> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Double>>

A sequence of nullable Double values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Int32>>)

Asynchronously computes the average of a sequence of nullable Int32 values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<int>> source
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Int32>>

A sequence of nullable Int32 values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Int32>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int32 values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<int>> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Int32>>

A sequence of nullable Int32 values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Int64>>)

Asynchronously computes the average of a sequence of nullable Int64 values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<long>> source
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Int64>>

A sequence of nullable Int64 values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Int64>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int64 values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync(
	this IQueryable<Nullable<long>> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Int64>>

A sequence of nullable Int64 values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Single>>)

Asynchronously computes the average of a sequence of nullable Single values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<float>> AverageAsync(
	this IQueryable<Nullable<float>> source
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Single>>

A sequence of nullable Single values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Single>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Nullable<Single>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Single values.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<float>> AverageAsync(
	this IQueryable<Nullable<float>> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Nullable<Single>>

A sequence of nullable Single values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Nullable<Single>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Single>)

Asynchronously computes the average of a sequence of Single values.

public static Task<float> AverageAsync(
	this IQueryable<float> source
)

Parameters

source
Type: System.Linq.IQueryable<Single>

A sequence of Single values to calculate the average of.

Return Value

Type: System.Threading.Tasks.Task<Single>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync Method (IQueryable<Single>, CancellationToken)

Asynchronously computes the average of a sequence of Single values.

public static Task<float> AverageAsync(
	this IQueryable<float> source,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<Single>

A sequence of Single values to calculate the average of.

cancellationToken
Type: System.Threading.CancellationToken

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

Return Value

Type: System.Threading.Tasks.Task<Single>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Exception Condition
ArgumentNullException

source is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Decimal>>)

Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<decimal> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, decimal>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Decimal>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Decimal>>, CancellationToken)

Asynchronously computes the average of a sequence of Decimal values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<decimal> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, decimal>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

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<Decimal>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Double>>)

Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, double>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Double>>, CancellationToken)

Asynchronously computes the average of a sequence of Double values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, double>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

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<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int32>>)

Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, int>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int32>>, CancellationToken)

Asynchronously computes the average of a sequence of Int32 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, int>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

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<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int64>>)

Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, long>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Int64>>, CancellationToken)

Asynchronously computes the average of a sequence of Int64 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public static Task<double> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, long>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

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<Double>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>)

Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<decimal>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<decimal>>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Decimal>>>

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Decimal>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Decimal>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Decimal values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<decimal>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<decimal>>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Decimal>>>

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<Nullable<Decimal>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>)

Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<double>>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Double>>>

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Double>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Double values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<double>>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Double>>>

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<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>)

Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<int>>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Int32>>>

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int32>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int32 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<int>>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Int32>>>

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<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>)

Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<long>>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Int64>>>

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Int64>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Int64 values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<double>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<long>>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Int64>>>

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<Nullable<Double>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>)

Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<float>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<float>>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Single>>>

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Nullable<Single>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Nullable<Single>>>, CancellationToken)

Asynchronously computes the average of a sequence of nullable Single values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<Nullable<float>> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, Nullable<float>>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

selector
Type: System.Linq.Expressions.Expression<Func<TSource, Nullable<Single>>>

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<Nullable<Single>>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Single>>)

Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<float> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, float>> selector
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

A projection function to apply to each element.

Return Value

Type: System.Threading.Tasks.Task<Single>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.


QueryableExtensions.AverageAsync<TSource> Method (IQueryable<TSource>, Expression<Func<TSource, Single>>, CancellationToken)

Asynchronously computes the average of a sequence of Single values that is obtained by invoking a projection function on each element of the input sequence.

[SuppressMessageAttribute("Microsoft.Design", "CA1011:ConsiderPassingBaseTypesAsParameters")]
[SuppressMessageAttribute("Microsoft.Design", "CA1006:DoNotNestGenericTypesInMemberSignatures")]
public static Task<float> AverageAsync<TSource>(
	this IQueryable<TSource> source,
	Expression<Func<TSource, float>> selector,
	CancellationToken cancellationToken
)

Parameters

source
Type: System.Linq.IQueryable<TSource>

A sequence of values to calculate the average of.

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

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<Single>

A task that represents the asynchronous operation. The task result contains the average of the sequence of values.

Type Parameters

TSource

The type of the elements of source .

Exception Condition
ArgumentNullException

source or selector is null .

InvalidOperationException

source does not implement IDbAsyncQueryProvider .

InvalidOperationException

source contains no elements.

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.