Initializing an array - CSharp Language Basics

CSharp examples for Language Basics:Array

Description

Initializing an array

Demo Code

using System;/*w w w  .ja v  a2 s.c  o m*/
public class Fname
{
    public static void Main()
    {
        char[] name = new char[] { 'B', 'r', 'a', 'd', 'l', 'e', 'y', (char)0 };
        Console.WriteLine("Display content of name array...");
        int i = 0;
        while (name[i] != 0)
        {
            Console.Write("{0}", name[i]);
            i++;
        }
    }
}

Result


Related Tutorials