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 www.  j a v  a  2  s .  c  o  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