13

Like in Eclipse for Java, where it can auto-generate getters and setters for class variables, can Visual Studio 2010 do this as well?

Ola Ström
  • 4,136
  • 5
  • 22
  • 41
Scott
  • 4,066
  • 10
  • 38
  • 54

4 Answers4

27

I usually type prop in the code editor and then press Tab twice. Another possibility is to right click on the private field and Refactor -> Encapsulate Field ... or Ctrl+R,E but the first method is more convenient for me.

Darin Dimitrov
  • 1,023,142
  • 271
  • 3,287
  • 2,928
2

just write propfull + TAB to auto-generate getter & setters the way Eclipse would.

Almak
  • 21
  • 1
2

Press 'Alt + Insert', then choose 'Properties'. Though I tried it in VS 2012, not sure about 2010 but still worth a try.

There all of your class variables are visible. Select the variables that you want to create properties of. This is similar to what you have referred to in Eclipse.

Syed Waqas
  • 2,576
  • 4
  • 29
  • 36
0

you aso have to option to download an addin who does that ie : http://www.codeproject.com/KB/codegen/PropertiesGenerator.aspx