How to create string array without elements in C#

1 Answer

0 votes
using System;

class Program
{
    static void Main() {
        var arr1 = new string[] {};
        Console.WriteLine(arr1.Length == 0);
        
        var arr2 = new string[0];
        Console.WriteLine(arr2.Length == 0);
    }
}




/*
run:

True
True

*/

 



answered Mar 8, 2023 by avibootz
...