- Data Structure
- Networking
- RDBMS
- Operating System
- Java
- MS Excel
- iOS
- HTML
- CSS
- Android
- Python
- C Programming
- C++
- C#
- MongoDB
- MySQL
- Javascript
- PHP
- Physics
- Chemistry
- Biology
- Mathematics
- English
- Economics
- Psychology
- Social Studies
- Fashion Studies
- Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
How to declare an empty string array in C#?
In C#, you can use strings as an array of characters, However, more common practice is to use the string keyword to declare a string variable. The string keyword is an alias for the System.String class.
To declare an empty string.
string[] arr = new string[] {}; // empty string
Now let us see what will happen when we will print this empty string.
Example
using System; namespace Demo { class Program { static void Main(string[] args) { string[] arr = new string[] {}; // empty string string res = String.Join(" ", arr); // let us now print the empty string Console.WriteLine("This won't print any message since its an empty string {0}", res); } } }
Output
This won't print any message since its an empty string
Advertisements