Finding the first word that begins with 't' or 'T' - CSharp LINQ

CSharp examples for LINQ:IEnumerable

Description

Finding the first word that begins with 't' or 'T'

Demo Code



using System;// ww  w  . ja  v  a 2  s .  co m
using System.Collections.Generic;

class Program
{
    static void Main(string[] args)
    {

        List<string> words = new List<string> { "one", "two", "three", "four", "five" };

        string firstTWord = words.Find(word => word.ToLower().StartsWith("t"));
        Console.WriteLine("\t{0}", firstTWord);
    }
}

Result


Related Tutorials