Compartir a través de


Aggregate Methods (LINQ to Entities)

Most of the aggregate methods that accept primitive data types are supported in LINQ to Entities. For more information, see Standard Query Operators in LINQ to Entities Queries. The following table lists the supported and unsupported aggregate methods.

Supported and Unsupported Methods

Method Support Visual Basic function signature C# method signature

Aggregate

Not supported

Function Aggregate(Of TSource) ( _
source As IQueryable(Of TSource), _
func As Expression(Of Func(Of TSource, TSource, TSource)) _
) As TSource
TSource Aggregate<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, TSource, TSource>> func
)

Aggregate

Not supported

Function Aggregate(Of TSource, TAccumulate) ( _
source As IQueryable(Of TSource), _
seed As TAccumulate, _
func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)) _
) As TAccumulate
TAccumulate Aggregate<TSource, TAccumulate>(
this IQueryable<TSource> source,
TAccumulate seed,
Expression<Func<TAccumulate, TSource, TAccumulate>> func
)

Aggregate

Not supported

Function Aggregate(Of TSource, TAccumulate, TResult) ( _
source As IQueryable(Of TSource), _
seed As TAccumulate, _
func As Expression(Of Func(Of TAccumulate, TSource, TAccumulate)), _
selector As Expression(Of Func(Of TAccumulate, TResult)) _
) As TResult
TResult Aggregate<TSource, TAccumulate, TResult>(
this IQueryable<TSource> source,
TAccumulate seed,
Expression<Func<TAccumulate, TSource, TAccumulate>> func,
Expression<Func<TAccumulate, TResult>> selector
)

Average

Supported

Function Average ( _
source As IQueryable(Of Decimal) _
) As Decimal
decimal Average(
this IQueryable<decimal> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Double) _
) As Double
double Average(
this IQueryable<double> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Integer) _
) As Double
double Average(
this IQueryable<int> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Long) _
) As Double
double Average(
this IQueryable<long> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Nullable(Of Decimal)) _
) As Nullable(Of Decimal)
Nullable<decimal> Average(
this IQueryable<Nullable<decimal>> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Nullable(Of Double)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<double>> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Nullable(Of Integer)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<int>> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Nullable(Of Long)) _
) As Nullable(Of Double)
Nullable<double> Average(
this IQueryable<Nullable<long>> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Nullable(Of Single)) _
) As Nullable(Of Single)
Nullable<float> Average(
this IQueryable<Nullable<float>> source
)

Average

Supported

Function Average ( _
source As IQueryable(Of Single) _
) As Single
float Average(
this IQueryable<float> source
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Integer)) _
) As Double
double Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, int>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Integer))) _
) As Nullable(Of Double)
Nullable<double> Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<int>>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Long)) _
) As Double
double Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, long>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Long))) _
) As Nullable(Of Double)
Nullable<double> Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<long>>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Single)) _
) As Single
float Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, float>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Single))) _
) As Nullable(Of Single)
Nullable<float> Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<float>>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Double)) _
) As Double
double Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, double>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Double))) _
) As Nullable(Of Double)
Nullable<double> Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<double>>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Decimal)) _
) As Decimal
decimal Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, decimal>> selector
)

Average

Not supported

Function Average(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Decimal))) _
) As Nullable(Of Decimal)
Nullable<decimal> Average<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<decimal>>> selector
)

Count

Supported

Function Count(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Integer
int Count<TSource>(
this IQueryable<TSource> source
)

Count

Not supported

Function Count(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As Integer
int Count<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

LongCount

Supported

Function LongCount(Of TSource) ( _
source As IQueryable(Of TSource) _
) As Long
long LongCount<TSource>(
this IQueryable<TSource> source
)

LongCount

Not supported

Function LongCount(Of TSource) ( _
source As IQueryable(Of TSource), _
predicate As Expression(Of Func(Of TSource, Boolean)) _
) As Long
long LongCount<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, bool>> predicate
)

Max

Supported

Function Max(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Max<TSource>(
this IQueryable<TSource> source
)

Max

Not supported

Function Max(Of TSource, TResult) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, TResult)) _
) As TResult
TResult Max<TSource, TResult>(
this IQueryable<TSource> source,
Expression<Func<TSource, TResult>> selector
)

Min

Supported

Function Min(Of TSource) ( _
source As IQueryable(Of TSource) _
) As TSource
TSource Min<TSource>(
this IQueryable<TSource> source
)

Min

Not supported

Function Min(Of TSource, TResult) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, TResult)) _
) As TResult
TResult Min<TSource, TResult>(
this IQueryable<TSource> source,
Expression<Func<TSource, TResult>> selector
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Decimal) _
) As Decimal
decimal Sum(
this IQueryable<decimal> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Double) _
) As Double
double Sum(
this IQueryable<double> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Integer) _
) As Integer
int Sum(
this IQueryable<int> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Long) _
) As Long
long Sum(
this IQueryable<long> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Nullable(Of Decimal)) _
) As Nullable(Of Decimal)
Nullable<decimal> Sum(
this IQueryable<Nullable<decimal>> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Nullable(Of Double)) _
) As Nullable(Of Double)
Function Sum ( _
source As IQueryable(Of Nullable(Of Double)) _
) As Nullable(Of Double)Nullable<double> Sum(
this IQueryable<Nullable<double>> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Nullable(Of Integer)) _
) As Nullable(Of Integer)
Nullable<int> Sum(
this IQueryable<Nullable<int>> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Nullable(Of Long)) _
) As Nullable(Of Long)
Nullable<long> Sum(
this IQueryable<Nullable<long>> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Nullable(Of Single)) _
) As Nullable(Of Single)
Nullable<float> Sum(
this IQueryable<Nullable<float>> source
)

Sum

Supported

Function Sum ( _
source As IQueryable(Of Single) _
) As Single
float Sum(
this IQueryable<float> source
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Integer)) _
) As Integer
int Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, int>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Integer))) _
) As Nullable(Of Integer)
Nullable<int> Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<int>>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Long)) _
) As Long
long Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, long>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Long))) _
) As Nullable(Of Long)
Nullable<long> Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<long>>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Single))) _
) As Nullable(Of Single)
Nullable<float> Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<float>>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Single)) _
) As Single
float Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, float>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Double)) _
) As Double
double Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, double>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Double))) _
) As Nullable(Of Double)
Nullable<double> Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<double>>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Decimal)) _
) As Decimal
decimal Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, decimal>> selector
)

Sum

Not supported

Function Sum(Of TSource) ( _
source As IQueryable(Of TSource), _
selector As Expression(Of Func(Of TSource, Nullable(Of Decimal))) _
) As Nullable(Of Decimal)
Nullable<decimal> Sum<TSource>(
this IQueryable<TSource> source,
Expression<Func<TSource, Nullable<decimal>>> selector
)

See Also

Concepts

Supported and Unsupported Methods (LINQ to Entities)