Linq Example 37 - Min Projection

11:14 PM
Linq Query:

// Min Projection

            string[] words = { "GodOfWar", "CallOfDuty", "AssasinCreed" };

            int shortestWord = words.Min(w => w.Length);

            Console.WriteLine("The shortest word is {0} characters long.", shortestWord);

//

Output:

The shortest word is 8 characters long.

0 comments:

Post a Comment