uses Min to get the length of the shortest word in a string array. : Min : LINQ C# Source Code


Custom Search

C# Source Code » LINQ » Min »

 

uses Min to get the length of the shortest word in a string array.








    
 
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

public class MainClass {
    public static void Main() {
        string[] words = { "cherry", "apple", "blueberry" };

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

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

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo LINQ
» Min