views:

281

answers:

3

I'm using the class designer in Visual Studio 2008 and when I add properties to my classes they are created with an empty setter and a getter that throws a NotImplementedException. In the properties window there's an option called "Auto-Implemented" which is always greye out. Is there a way to change the settings for this so by default new properties will be auto-implemented or some way to turn this option on so I don't have to keep editing the code each time I add in a new property?

+2  A: 

AFAIK, you can't. I asked this at Barcelona a year or so ago - I don't think anything has changed. Basically, as I understand it, this is done directly (not via an editable snippet).

Marc Gravell
Still valid answer with VS 2010 Ultimate :S
Mohamed Meligy
A: 

You can create field, and encapsulate it(Refactor->Encapsulate field).
This can help for simple properties.

Avram
+2  A: 

For visual studio 2008 you could install this "power toys" that give you another option to class designer menu "create auto-implemented property"

http://modeling.codeplex.com/

i'll waiting this for Visual Studio 2010 too... else it's so annoying