Home > Code > LINQ > Find length of the longest word in array of string using LINQ

Find length of the longest word in array of string using LINQ

by Raja   on May 23, 2011   Category: LINQ   |  Views: 4053    |  Points: 25   |  Bronze 


Given sample code explains the how to find the length of the longest word in the array of string using linq in easy way.

public void findlongestWord()
{
string[] GivenString = { "Keyboard", "Monitor", "Mouse","Motherboard","RAM" };
int Len = GivenString.Max(w => w.Length);
Response.Write("The length of longest word is "+ Len);
}



Include the namespace using System.Linq;


Post Code  |  Code Snippet Home

User Responses


No response found, be the first to review this code snippet.

Submit feedback about this code snippet

Please sign in to post feedback

Latest Posts