CSharp - Calling the First FirstOrDefault Prototype Where an Element Is Found

Description

Calling the First FirstOrDefault Prototype Where an Element Is Found

Demo

using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;
class Program//from   ww  w  .  j  ava  2  s. co  m
{
    static void Main(string[] args)
    {
        string[] codeNames = {"Python", "Java", "Javascript", "Bash", "C++", "Oracle"};
        
        string name = codeNames.FirstOrDefault();
        Console.WriteLine(name == null ? "NULL" : name);
    }
}

Result

Related Topic