빈 문자열 배열을 만들려면 -
string[] str = new string[] {}; 위에서 배열이 비어 있으므로 요소를 추가하지 않았습니다.
배열을 반복하더라도 아래와 같이 아무것도 표시되지 않습니다. -
예
using System;
public class Demo {
public static void Main() {
string[] str = new string[] {};
Console.WriteLine("String Array elements won't get displayed since it's empty...");
for (int i = 0; i < str.Length; i++) {
string res = str[i];
Console.WriteLine(res);
}
}
} 출력
String Array elements won't get displayed since it's empty...