All the above is basically correct. One can check it. Just write a short method
public static void Main(){ var s = "a string";}
compile it and open .exe
with ildasm
to see
.method private hidebysig static void Main(string[] args) cil managed{ .entrypoint // Code size 8 (0x8) .maxstack 1 .locals init ([0] string s) IL_0000: nop IL_0001: ldstr "a string" IL_0006: stloc.0 IL_0007: ret} // end of method Program::Main
then change var
to string
and String
, compile, open with ildasm
and see IL
does not change. It also shows the creators of the language prefer just string
when difining variables (spoiler: when calling members they prefer String
).