C#C
C#7mo ago
jd

✅ Creating arrays

I’m coming from C where I can either create an array by doing int num[]={}; or int num[2];

It seems that for C# there are many different ways to do it. I understand int[] x = {1,2,3}; and int[] x = new int[3];

I am confused on how int[]x = new int[] {1,2,3}; works, I am confused on how this isn’t the same as int[] x = {1,2,3};

Also am I able to just do int[] x?
Was this page helpful?