If you declare an
Int32
as
Object
, you've just boxed a value type, which is terrible sloppy coding with real performance implications. If you declare an
Int32
as
var
, all you've done is shift the reader's focus on the parts of the code that actually matter, as opposed to making your C# read like Java. FWIW you shouldn't even need to mention
var
until you're ready to get into anonymous types and LINQ. Also, hover the mouse over
var
, the IDE tells you what the compiler type is.
var
has NOTHING to do with
Object
whatsoever. And it's NOT dangerous, even less "sloppy". —
Mathieu Guindon 15 secs ago