My boss forbids me to use var as it would cause boxing and slowing down the app.
var
Is that true?
An approach that might work is to write these two methods:
public static void WithInt() { int x = 5; Console.WriteLine(x); } public static void WithVar() { var x = 5; Console.WriteLine(x); }
Compile, and use ildasm to examine the produced CIL. Show your boss.
ildasm
edit @ck has done all but the last step for you :)
2.1m questions
2.1m answers
60 comments
57.0k users