I want to inizialize a new int array.
What are the advantages of:
var myNewArray = new int[]{};
And:
var myNewArray = new int[0];
Which one should I prefer over the other, or is it just a matter of code-style?
I want to inizialize a new int array.
What are the advantages of:
var myNewArray = new int[]{};
And:
var myNewArray = new int[0];
Which one should I prefer over the other, or is it just a matter of code-style?
There is no difference. Both produce the same IL:
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: newarr System.Int32
IL_0007: stloc.0 // myNewArray
IL_0008: ret