Enumerable.First : Enumerable « System.Linq « C# / C Sharp by API






Enumerable.First

 

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class MainClass {
    public static void Main() {

        string[] presidents = {"G", "H", "a", "H", "over", "Jack"};

        string jones = presidents.Where(n => n.Equals("H")).First();
        if (jones != null)
            Console.WriteLine("H was found");
        else
            Console.WriteLine("H was not found");

    }
}

   
  








Related examples in the same category

1.Enumerable.Aggregate
2.Enumerable.Average()
3.Enumerable.Cast
4.Enumerable.Count()
5.Enumerable.DefaultIfEmpty
6.Enumerable.Distinct()
7.Enumerable.ElementAt
8.Enumerable.ElementAtOrDefault
9.Enumerable.ElementsAfterSelf
10.Enumerable.Empty
11.Enumerable.OrderBy
12.Enumerable.Range
13.Enumerable.Repeat
14.Enumerable.Where