empty array c# code example
Example 1: c# declare empty string array
string[] stringArray = new string[] {};
Example 2: c# check if array is empty
if(array == null || array.Length == 0)
Example 3: c# initialize empty array
datatype[] arr = new datatype[]{};
or
datatype[] arr = new datatype[0];
or
datatype[] array = {}
or
var a = Array.Empty<datatype>();
Example 4: c# empty array
object[] emptyArray = new object[0];
Example 5: how to empty an array c#
Array.Clear(arr, 0, arr.Length);