Is there any tools to help me refactor a method call from using position-based to name-based parameters

混江龙づ霸主 提交于 2020-01-14 07:55:08

问题


I wish to transform code like:

var p = new Person("Ian", "Smith", 40, 16)

To:

var p = new Person(surname: "Ian", givenName:"Smith", weight:40, age:16)

As a first step in making the code more readable, I am willing to use a 3rd party refactoring tool if need be.

(Please do not tell me to use parameter objects and factor methods etc, these may come later once I can at least read the code!)


回答1:


Refactor v2001 vol 1.3 claims to be able to do it.

ReSharper has it in it's issues database, but have not commited doing it yet.




回答2:


place cursor in parentheses of method call

alt+<enter>

or click on hammer

  • before

  • after



来源:https://stackoverflow.com/questions/5550160/is-there-any-tools-to-help-me-refactor-a-method-call-from-using-position-based-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!