Query string value by String.StartsWith
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);
}
}
Related examples in the same category