Query string value by String.StartsWith

image_pdfimage_print
   
 
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
public class MainClass {
    public static void Main() {

        string[] presidents = {"Ad", "Ar", "Bu", "B", "C", "C"};

        string president = presidents.Where(p => p.StartsWith("Ad")).First();

        Console.WriteLine(president);
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.