Code snippet or shortcut to create a constructor in Visual Studio

前端 未结 17 1680
悲哀的现实
悲哀的现实 2020-12-23 12:57

What is the code snippet or shortcut for creating a constructor in Visual Studio?

Visual Studio 2010 and C#.

17条回答
  •  鱼传尺愫
    2020-12-23 13:25

    If you use ReSharper, you can quickly generate constructors by typing:

    • 'ctor' + Tab + Tab (without parameters),
    • 'ctorf' + Tab + Tab (with parameters that initialize all fields) or
    • 'ctorp' + Tab + Tab (with parameters that initialize all properties).

提交回复
热议问题