Below is a sample sourcecode demonstrating how to initialize Char Array in C# during the declaration of the char array.
How to initialize Char Array in C# ?
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace ConsoleApplication1 { class Program { static void Main(string[] args) { // Initialize character array in C# char[] chArray = new char[] { 'A' , 'B', 'U','N','D','A','N','T',' ','C','O','D','E' }; foreach (var ch in chArray) { Console.Write(ch); } Console.ReadLine(); } } }
Leave a Reply