Bryan_James
Member
Hi!
I'm new to C#. I have concerns regarding arrays.
[1]
[2]
I searched MSDN and other sites about this. They said that arrays in C# are objects, which is, System.Array is the abstract base type of all arrays. I understand that in [2], the int is being instantiated then initialized. Meanwhile, [1] didn't instantiate the integer type array. What is the major difference between the two? Why and when should I use [1] instead of [2] and vice versa? Why does [1] works without instantiating it?
Thanks in advance!
I'm new to C#. I have concerns regarding arrays.
[1]
C#:
int[] int_arr = {1, 2, 3, 4, 5};
C#:
int[] int_arr = new int[]{1, 2, 3, 4, 5};
Thanks in advance!