Use “convert to auto property” on multiple properties at once

前端 未结 2 518
再見小時候
再見小時候 2020-12-18 08:08

I find myself using Resharper\'s \"convert to auto property\" refactoring a lot to remove pre C# 3.0 boilerplate code.

Is there a way I can apply this to a

相关标签:
2条回答
  • 2020-12-18 08:50

    Tanascius has the right answer, though you can tweak that a little bit by creating your own custom Code Cleanup script that would ONLY include the "Use auto-property if possible" refactoring.

    That would probably be preferable if you didn't want the rest of the refactorings to run. Just hit the add button on the code cleanup and then uncheck everything else.

    -Max

    0 讨论(0)
  • 2020-12-18 09:00

    The ReSharper can do this:

    Options -> Code Cleanup -> Use auto-property, if possible
    

    Run code cleanup for the class - and you should be done.

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