I downloaded VS08 on Monday but didn’t really get round to doing anything until today. So far so good, looks nice. Installation was a bit long, but completed without any problems.
I just tried creating a class with some properties. Nothing really interesting, except that I’m used to using the “prop” snippet.
Well guess what Visual Studio generated when I did my usual prop + tab + tab?
public string User { get; set; }
I immediately screamed BUG, but I then came across this article by Daniel Moth. And then I remembered what this was. It’s a new feature called “Automatic Properties”. This reminds me that know I can actually start using all those features that all those slides at Tech-Ed this and last year were talking about.
I’m not sure if I’m going to like these automatic properties. It doesn’t really speed up my typing because the old prop template was just one word more, and I wonder it that one word was the cost for the flexibility of a full property template (think validation in the setters). I mean now I actually have to insert the brackets and new lines into the property myself. Well, time will tell. I’ll just start using what VS gives me (by the way, you can change those snippets if you want to using Vísual Studio options).
Another feature I’m going to force myself to start getting used to is Object Initializers. This wil certainly clean up some of my code.
User _u = new User(){ Name="Alex", Age=24 };
instead of
User _u = User();
_u.Name = Alex;
_u.Age = 24;
(and it works nested aswell!)
Read Bard de Smet’s post about this here.