
- C# Basic Tutorial
- C# - Home
- C# - Overview
- C# - Environment
- C# - Program Structure
- C# - Basic Syntax
- C# - Data Types
- C# - Type Conversion
- C# - Variables
- C# - Constants
- C# - Operators
- C# - Decision Making
- C# - Loops
- C# - Encapsulation
- C# - Methods
- C# - Nullables
- C# - Arrays
- C# - Strings
- C# - Structure
- C# - Enums
- C# - Classes
- C# - Inheritance
- C# - Polymorphism
- C# - Operator Overloading
- C# - Interfaces
- C# - Namespaces
- C# - Preprocessor Directives
- C# - Regular Expressions
- C# - Exception Handling
- C# - File I/O
- C# Advanced Tutorial
- C# - Attributes
- C# - Reflection
- C# - Properties
- C# - Indexers
- C# - Delegates
- C# - Events
- C# - Collections
- C# - Generics
- C# - Anonymous Methods
- C# - Unsafe Codes
- C# - Multithreading
- C# Useful Resources
- C# - Questions and Answers
- C# - Quick Guide
- C# - Useful Resources
- C# - Discussion
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
- Related Articles
- How to declare an array in C#?
- How to declare a static String array in Java
- C# program to create an empty string array
- How to declare an Array Variables in Java?
- In Javascript how to empty an array
- How to empty an array in Java
- How to empty an array in JavaScript?
- How to initialize a string to an empty string in C#?
- How to create an empty array in Kotlin?
- How to initialize an empty array list in Kotlin?
- How to declare, create, initialize and access an array in Java?
- How to remove an empty string from a list of empty strings in C#?
- how can I declare an Object Array in Java?
- How to declare String Variables in JavaScript?
- How do I empty an array in JavaScript?

Advertisements