Use FirstOrDefault operator with condition
using System; using System.Linq; using System.Collections; using System.Collections.Generic; class Program//from w w w.jav a2s . co m { static void Main(string[] args) { string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"}; string name = codeNames.FirstOrDefault(p => p.StartsWith("B")); Console.WriteLine(name == null ? "NULL" : name); } }