Finding the length of the longest word in array of string using LINQ.

Posted by Vishalneeraj-24503 under LINQ category on | Points: 40 | Views : 290
Include the namespace using System.Linq;

public void find_longest_word()
string[] Given_String = { "Vishal", "NeerajC", "Shanu","Ram","Amit" };
int Len = Given_String.Max(w => w.Length);
Response.Write("The length of longest word is "+ Len);

Output :-
The length of longest word is 7 i.e NeerajC

Comments or Responses

Login to post response