EdmFunctions.Average Method (DbExpression)

 

Creates a DbFunctionExpression that invokes the canonical 'Avg' function over the specified collection. The result type of the expression is the same as the element type of the collection.

Namespace:   System.Data.Entity.Core.Common.CommandTrees.ExpressionBuilder
Assembly:  EntityFramework (in EntityFramework.dll)

public static DbFunctionExpression Average(
	this DbExpression collection
)

Parameters

collection
Type: System.Data.Entity.Core.Common.CommandTrees.DbExpression

An expression that specifies the collection from which the average value should be computed.

Return Value

Type: System.Data.Entity.Core.Common.CommandTrees.DbFunctionExpression

A new DbFunctionExpression that produces the average value.

Exception Condition
ArgumentNullException

collection is null.

ArgumentException

No overload of the canonical ‘Avg’ function accepts an argument with the result type of collection.