Automatically Add Regions to Code in Visual Studio

后端 未结 7 1897
轻奢々
轻奢々 2021-02-20 06:09

My team absolutely loves using regions, and with that in mind it\'s pretty much become a de-facto standard in our code. I recently came to realization that I\'m sick of writing

7条回答
  •  广开言路
    2021-02-20 07:06

    I prefer editing the class template as described in Sam Harwell's answer:

    https://stackoverflow.com/a/2072717

    You can open the class.cs file at your Visual Studio version's class template location. For example, Visual Studio 2017 Enterprise's location is:

    C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\ItemTemplates\CSharp\Code\1033\Class\Class.cs

    I open that file using a text editor and add regions to it. All new classes will then be created with the regions.

提交回复
热议问题