IEnumerable<T>.Average Method

Overloads

Average

Computes the average of the sequence.

Average(Func<T,Integer>)

Computes the average of a sequence of Integer values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Int64>)

Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Single>)

Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Double>)

Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Average(Func<T,Currency>)

Computes the average of a sequence of Currency values that are obtained by invoking a transform function on each element of the input sequence.

Average

Computes the average of the sequence.

Delphi
function Average: Double

Returns

Double

The average of all elements in the sequence.

Exceptions

T is not a supported numeric type.

The sequence is empty.

Average(Func<T,Integer>)

Computes the average of a sequence of Integer values that are obtained by invoking a transform function on each element of the input sequence.

Delphi
function Average(const selector: Func<T, Integer>): Double

Parameters

selector
Func<T, Integer>

A transform function to apply to each element.

Returns

Double

The average of the sequence of values.

Exceptions

selector is nil .

The sequence is empty.

The sum of the elements in the sequence is larger than Int64.MaxValue.

Average(Func<T,Int64>)

Computes the average of a sequence of Int64 values that are obtained by invoking a transform function on each element of the input sequence.

Delphi
function Average(const selector: Func<T, Int64>): Double

Parameters

selector
Func<T, Int64>

A transform function to apply to each element.

Returns

Double

The average of the sequence of values.

Exceptions

selector is nil .

The sequence is empty.

The sum of the elements in the sequence is larger than Int64.MaxValue.

Average(Func<T,Single>)

Computes the average of a sequence of Single values that are obtained by invoking a transform function on each element of the input sequence.

Delphi
function Average(const selector: Func<T, Single>): Double

Parameters

selector
Func<T, Single>

A transform function to apply to each element.

Returns

Double

The average of the sequence of values.

Exceptions

selector is nil .

The sequence is empty.

Average(Func<T,Double>)

Computes the average of a sequence of Double values that are obtained by invoking a transform function on each element of the input sequence.

Delphi
function Average(const selector: Func<T, Double>): Double

Parameters

selector
Func<T, Double>

A transform function to apply to each element.

Returns

Double

The average of the sequence of values.

Exceptions

selector is nil .

The sequence is empty.

Average(Func<T,Currency>)

Computes the average of a sequence of Currency values that are obtained by invoking a transform function on each element of the input sequence.

Delphi
function Average(const selector: Func<T, Currency>): Double

Parameters

selector
Func<T, Currency>

A transform function to apply to each element.

Returns

Double

The average of the sequence of values.

Exceptions

selector is nil .

The sequence is empty.