First operator with condition
using System; using System.Linq; using System.Collections; using System.Collections.Generic; class Program// ww w. j av a2s . c o m { static void Main(string[] args) { string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"}; string name = codeNames.First(p => p.StartsWith("J")); Console.WriteLine(name); } }
The following code should return the first element in the input sequence that begins with the string "J".