Max - Projection

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

int longestLength = words.Max(w => w.Length);

Console.WriteLine("The longest word is {0} characters long.", longestLength);
}
Lambda Expression
public void Linq86()
{
string[] words = { "cherry", "apple", "blueberry" };

int longestLength = words.Max(w => w.Length);

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