How do I create auto-implemented properties in the VS class designer

前端 未结 4 789
悲&欢浪女
悲&欢浪女 2021-01-18 04:06

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 NotImplementedEx

相关标签:
4条回答
  • 2021-01-18 04:11

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

    0 讨论(0)
  • 2021-01-18 04:30

    You can also create a property by using snippet propfull, then Tab, Tab.

    0 讨论(0)
  • 2021-01-18 04:33

    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).

    0 讨论(0)
  • 2021-01-18 04:36

    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

    0 讨论(0)
提交回复
热议问题