Skip to content

Instantly share code, notes, and snippets.

@marcioalthmann
Created July 30, 2014 00:06
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save marcioalthmann/2bc1c5d23123c5cdd765 to your computer and use it in GitHub Desktop.
Save marcioalthmann/2bc1c5d23123c5cdd765 to your computer and use it in GitHub Desktop.
select-sum
[Test()]
public void Somando_mais_de_uma_propriedade_com_select_mais_sum()
{
var lista = new List<Objeto> ();
lista.Add (new Objeto{ PrimeiroValor = 10, SegundoValor = 20 });
lista.Add (new Objeto{ PrimeiroValor = 30, SegundoValor = 40 });
Assert.AreEqual(100, lista.Select(x => x.PrimeiroValor + x.SegundoValor).Sum());
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment