Average - Projection

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

double averageLength = words.Average(w => w.Length);

Console.WriteLine("The average word length is {0} characters.", averageLength);
}
Lambda Expression
public void Linq90()
{
string[] words = { "cherry", "apple", "blueberry" };

double averageLength = words.Average(w => w.Length);

Console.WriteLine("The average word length is {0} characters.", averageLength);
}
Output
The average word length is 6.66666666666667 characters.
Related Tutorial
Follow Us
https://www.facebook.com/Rookie-Nerd-638990322793530 https://twitter.com/RookieNerdTutor https://plus.google.com/b/117136517396468545840 #
Contents +