Use Any on empty string array in CSharp

Description

The following code shows how to use Any on empty string array.

Example


/*from w ww  .j a  v a  2s . com*/
using System;
using System.Linq;
using System.Collections;
using System.Collections.Generic;

public class MainClass
{
    public static void Main() {
        string[] presidents = {"string"};

        bool any = presidents.Any();
        Console.WriteLine(any);
        
    }
}

The code above generates the following result.





















Home »
  C# Tutorial »
    LINQ »




Operator
Select
Where
OrderBy
Group
Join
Let
LINQ