add parameter refactoring on constructor calls

Is there a reason that I can do this with methods but not with constructor
calls? There is only "create constructor overload" which isn't what I want.

--
/\/\arkus.

3 comments

Hello Markus,

Could you please attach a screenshot demonstrating the list of actions on
a method call with additional parameter and a constructor call with additional
parameter? Thank you!

Andrey Serebryansky
Senior Support Engineer
JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"

Is there a reason that I can do this with methods but not with
constructor calls? There is only "create constructor overload" which
isn't what I want.



0

Andrew,

Could you please attach a screenshot demonstrating the list of actions on
a method call with additional parameter and a constructor call with additional
parameter? Thank you!


In a simple HelloWorld app it works :(
-- of course never in my real-world app.

--
/\/\arkus.

0

Andrew,

Could you please attach a screenshot demonstrating the list of actions on
a method call with additional parameter and a constructor call with additional
parameter? Thank you!


Got it:
When the currently existing right-most parameter has the same type than the
additional used parameter than neither the method-call nor the
constructor-"call" get an "add parameter" quickfix:

public class Class1
{
     public Class1(string baseparam)
     {
     }

     public static void DoSomething(string baseparam)
     {
     }

     public static Class1 DoCalls()
     {
          string additionalParamdata = null;
          DoSomething("dummy", additionalParamdata);

          return new Class1("moo", additionalParamdata);
     }
}

If you change the type of "additionalParamdata" it suddenly starts to work.

--
/\/\arkus.

0

Please sign in to leave a comment.