Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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!)

like image 840
Ian Ringrose Avatar asked Apr 05 '11 10:04

Ian Ringrose


2 Answers

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.

like image 86
Ian Ringrose Avatar answered Sep 25 '22 17:09

Ian Ringrose


place cursor in parentheses of method call

alt+<enter>

or click on hammer

  • before

enter image description here

  • after

enter image description here

like image 45
Chris Hayes Avatar answered Sep 23 '22 17:09

Chris Hayes