I recently discovered that two ways to declare array in C#, those are:
- int[,] array = new int[4, 2];
- int[] test = { 4, 2 };
Could anyone please describe the difference between those two statements?
I recently discovered that two ways to declare array in C#, those are:
int[,] array = new int[4, 2];int[] test = { 4, 2 };Could anyone please describe the difference between those two statements?
 
    
     
    
    int[,] array = new int[4, 2]; 
creates array with 8 elements having the default value of 0 and 2 dimensions
int[] test = { 4, 2 }; 
creates array with 2 elements(4 and 2) and 1 dimension
 
    
    