Windows Phone Developers

Friday, December 5, 2008

Specify initial values of the array in .NET (C#)

Initial values of the array elements can be specified using an array initializer, which is a list of expressions written between the delimiters { and }

static void ArrayExample()

{

int[] Marks = {56, 78, 45};

int[,] Matrix = new int[5, 5];

string[] Students = {"George Kutty", "Madhavan Nair", "Haneef Iqbal"} ;

for (int i=0;i

{

Console.WriteLine("Student Name: {0} - Marks {1}" , Students[i], Marks[i]);

}

}

Digg Technorati Delicious StumbleUpon Reddit BlinkList Furl Mixx Facebook Google Bookmark Yahoo
ma.gnolia squidoo newsvine live netscape tailrank mister-wong blogmarks slashdot spurl StumbleUpon

No comments:

Post a Comment