My boss forbids me to use var
as it would cause boxing and slowing down the app.
Is that true?
See Question&Answers more detail:osMy boss forbids me to use var
as it would cause boxing and slowing down the app.
Is that true?
See Question&Answers more detail:osAn 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.
edit @ck has done all but the last step for you :)