Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
Selected Reading
C# program to create an empty string array
To create an empty string array −
string[] str = new string[] {};
Above, we haven’t added elements to the array, since it is empty.
Even if we will loop though the array, it won’t display anything as shown below −
Example
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);
}
}
}
Output
String Array elements won't get displayed since it's empty...
Advertisements
