Array Math.Sum<T, U>(IEnumerable<T>, Func<T, U>) Method
Computes the sum of the sequence of values that are obtained
by invoking a transform function on each element of the input sequence.
Definition
Namespace: Extreme.Mathematics
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
C#
The sum of the projected values.
Assembly: Extreme.Numerics (in Extreme.Numerics.dll) Version: 8.1.23
public static U Sum<T, U>(
this IEnumerable<T> source,
Func<T, U> selector
)
Parameters
- source IEnumerable<T>
- A sequence of values.
- selector Func<T, U>
- A transform function to apply to each element.
Type Parameters
- T
- The element type of source.
- U
- The type of the result.
Return Value
UThe sum of the projected values.