In Visual Studio 2005, there was a handy snippet to generate a property, which included a private variable and a public get and set, appropriately coded. By typing
prop and pressing tab, you got the following, which helped you choose the names:
With VS2008, there is a handy new feature, automatic properties, that work in the same way, but don't need the private member, the return or the assignment. This too has a snippet:
Cool. What's also cool is that you can compile .NET 2.0 projects in VS2008 as well as 3.0 and 3.5 without switching IDEs. So, whilst working on my .NET 2.0 project, I typed
prop and tabbed as usual, and got the new snippet. Which didn't compile. A nice touch would have been to have different snippets for different framework versions, automatically selected by the version the project was set to. I'm not sure whether to call this a bug or not, but it is certainly slightly irksome.