Prevent visual studio from limiting the setter method to internal

前端 未结 3 811
情话喂你
情话喂你 2020-12-31 01:44

Well, I use visual studio 2015 CE, update 2. One productivity hack I usually do is that I create empty model classes like:

public class PersonModel
{
}


        
相关标签:
3条回答
  • 2020-12-31 02:33

    You can do that by typing prop and press the TAB twice. It will require you to enter type and name for property though, won't extract it from existing one.

    Best regards.

    0 讨论(0)
  • 2020-12-31 02:34

    So my question is: is there any option to ask VS to create public setter, i.e.:

    No, there is no way to modify the shortcut to automatically add the property with a public set. Although your productivity hack is neat, your best bet is to create it yourself.

    0 讨论(0)
  • 2020-12-31 02:41

    Still the same in Visual Studio 2017 and I use the same "productivity hack".

    I recently got Resharper and it does use the public setter as we would expect it.

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