C# declare empty string array

Solution 1:

Try this

string[] arr = new string[] {};

Solution 2:

Your syntax is wrong:

string[] arr = new string[]{};

or

string[] arr = new string[0];

Solution 3:

If you are using .NET Framework 4.6 and later, they have some new syntax you can use:

using System;  // To pick up definition of the Array class.

var myArray = Array.Empty<string>();

Solution 4:

You can try this

string[] arr = {};