ArrayExtensions.Sum

Extension Method in ArrayExtensions

Declaration

public static int Sum(this int[] array)

Description

Calculates the sum of all elements in the array.

Parameters

arrayThe array to sum.

Returns

intThe sum of all elements in the array.

Overload

Declaration

public static float Sum(this float[] array)

Description

Calculates the sum of all elements in the array.

Parameters

arrayThe array to sum.

Returns

floatThe sum of all elements in the array.

Overload

Declaration

public static double Sum(this double[] array)

Description

Calculates the sum of all elements in the array.

Parameters

arrayThe array to sum.

Returns

doubleThe sum of all elements in the array.