Shortcut to instantiate an object in Visual Studio

前端 未结 4 1481

I have a class with more than 8 properties, and I often want to instantiate it in some method, but it is super tedious to have to write the properties one by one to assign t

4条回答
  •  醉梦人生
    2020-12-06 18:33

    If you are initialising like this:

      var example = new Example()
        {
            ...
        };
    

    Then you can use Ctrl-Space and it will keep offering you properties left for auto complete that you have yet to set.

提交回复
热议问题