linq.Sum

Sums a set of values

Overloads

  • Number Sum ()
  • Number Sum (selector)

Number Sum ()

Sums the values in the set

Example

var myArray = [1, 5, 3];
//Returns 9
//(1 + 5 + 3)
myArray.Sum();

Number Sum (selector)

Sums the values specified by the selector

Example

var myArray = [{a: 5}, {a: 3}, {a: 1}];
//Returns 6
//(5 - 1 + 3 - 1 + 1 - 1)
myArray.Sum("x => a - 1");

Last edited Sep 24, 2011 at 6:49 AM by mlorbetske, version 1

Comments

No comments yet.