int b=new int();
Does not create a reference type - it creates a value type.
int
is always a value type, the
new int()
syntax is just allowed for completion, it does not create any new allocation on the heap, and does not return a reference.
If you have a look at the IL it generates the same code:
int A = new int();
int B = 0;
.locals init ([0] int32 A,
[1] int32 B)
IL_0000: nop
IL_0001: ldc.i4.0
IL_0002: stloc.0
IL_0003: ldc.i4.0
IL_0004: stloc.1