First operator : First « LINQ « C# / C Sharp






First operator

 

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 name = presidents.First();
        Console.WriteLine(name);

    }
}

 








Related examples in the same category

1.Use First, Last with expression
2.First with string method
3.retrieves all strings in an array whose length matches that of the shortest string
4.Use First to return the first matching element as a Product