Sum - Projection

Query
public void Linq79()
{
string[] words = { "cherry", "apple", "blueberry" };

double totalChars = words.Sum(w => w.Length);

Console.WriteLine("There are a total of {0} characters in these words.", totalChars);
}
Lambda Expression
public void Linq79()
{
string[] words = { "cherry", "apple", "blueberry" };

double totalChars = words.Sum(w => w.Length);

Console.WriteLine("There are a total of {0} characters in these words.", totalChars);
}
Output
There are a total of 20 characters in these words.
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +