re: Find longest word in a given string VIEW POST

VIEW FULL DISCUSSION
 

Can I chime in with a quick C# and LINQ one liner?

private Longest(string sentance) 
{
     return sentance.Split(' ').OrderByDescending(l => l.Length).FirstOrDefault();
}

Well, the return statement is a one liner :)

code of conduct - report abuse