0

Consider a standard initialization:

Person p = new Person();

Visual studio is suggesting changing this code to

var p = new Person();

Why would I do this? I would expect my program is more readable if the type is explicit.

Stewart
  • 3,023
  • 2
  • 24
  • 40
  • The behavior is neither of C# or Visual Studio. – Lei Yang Dec 11 '15 at 02:05
  • 1
    In your example yes and I would agree. It's arguably more useful for verbose types such as `Dictionary>> y = new Dictionary>>();` simplified as `var x = new Dictionary>> ();`. Plus its jolly good for _anonymous types_ –  Dec 11 '15 at 02:36

0 Answers0