FirstOrDefault: get the first or the default

image_pdfimage_print
   
 

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

public class MainClass {
    public static void Main() {
        int[] numbers = { };

        int firstNumOrDefault = numbers.FirstOrDefault();

        Console.WriteLine(firstNumOrDefault);
    }
}

    


This entry was posted in LINQ. Bookmark the permalink.