C# 3.0 type initialisation inference

by benl

Ok so C# 3 introduces inference and shorthand for type initialisation:

var x = 10;
var s = "a string";

This appears to be fairly useful for saving a few keystrokes but sacrifices on readability a little don’t you think? I prefer the explicit approach:

int x = 10;
string s = "a string";

Would you agree?

Advertisements