要創建一個String數組,可以使用以下方式:
string[] array = { "Apple", "Banana", "Orange" };
string[] array = new string[3];
array[0] = "Apple";
array[1] = "Banana";
array[2] = "Orange";
string[] array = Array.CreateInstance(typeof(string), 3) as string[];
array[0] = "Apple";
array[1] = "Banana";
array[2] = "Orange";
無論使用哪種方法,都可以創建一個包含指定元素的String數組。