Array initialization

We can initialize an array by provide all of the values.

 
using System;

class Program
{
    static void Main(string[] args)
    {
        int[] intArray = new int[] { 1, 2, 3 };

        for (int i = 0; i < intArray.Length; i++)
        {
            Console.WriteLine(intArray[i]);
        }
    }
}
  

The output:


1
2
3
ww__w.__j__a_v___a_2___s._c__o__m_ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.