linq First Condition

This sample uses First to find the first element in the array that starts with 't'.
public static void First_Condition()
        {
            string[] strings = { "zero", "one", "two", "three", "four", "five", "six", "seven", "eight", "nine" };

            string startsWithO = strings.First(s => s[0] == 't');

            Console.WriteLine("A string starting with 't': {0}", startsWithO);
        }
Output


linq First Condition linq First Condition Reviewed by Bhaumik Patel on 4:16 AM Rating: 5