Declaring arrays in c#

Madhu.b.rokkam
Posted by Madhu.b.rokkam under C# category on | Points: 40 | Views : 2294
//These are all equivalent
int[] arr1 = new int[4];
arr1[0] = 1; arr1[1] = 4; arr1[2] = 8; arr1[3] = 6;
int[] arr2 = new int[4] { 1, 4, 8, 6 };
int[] arr3 = new int[] { 1, 4, 8, 6 };
int[] arr4 = { 1, 4, 8, 6 };

Comments or Responses

Login to post response