refactor both "introduce parameter" and "create overload without parameter" in one step

Hello,

given:
     public TJobDetails GetDetails()
     {
          using ( var strm = this.OpenFile(this.detailsFilename) )
          using ( var reader = XmlReader.Create(strm) )
               return detailsSerializer.Read(reader);
     }

Is there already a way to introduce a parameter for "this.detailsFilename"
while leaving every caller of this method untouched by introducing an
overload without the new parameter at the very same time?

So I want to end up with:
     public TJobDetails GetDetails(string fileName)
     {
          using ( var strm = this.OpenFile(fileName) )
          using ( var reader = XmlReader.Create(strm) )
               return detailsSerializer.Read(reader);
     }
     public TJobDetails GetDetails()
     {
          return this.GetDetails(this.detailsFilename);
     }

Is it possible already and I just did not find the according refactoring
menu item?

--
/\/\arkus.

0
2 comments
Avatar
Andrey Serebryansky

Hello Markus,

At the moment there's no way to do this in one step. You're welcome to put
a feature request through http://youtrack.jetbrains.net/issues/RSRP. Thank
you!

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

Hello,

given:
public TJobDetails GetDetails()
{
using ( var strm = this.OpenFile(this.detailsFilename) )
using ( var reader = XmlReader.Create(strm) )
return detailsSerializer.Read(reader);
}
Is there already a way to introduce a parameter for
"this.detailsFilename" while leaving every caller of this method
untouched by introducing an overload without the new parameter at the
very same time?

So I want to end up with:
public TJobDetails GetDetails(string fileName)
{
using ( var strm = this.OpenFile(fileName) )
using ( var reader = XmlReader.Create(strm) )
return detailsSerializer.Read(reader);
}
public TJobDetails GetDetails()
{
return this.GetDetails(this.detailsFilename);
}
Is it possible already and I just did not find the according
refactoring menu item?



0

Update,

     public TJobDetails GetDetails()
     {
          using ( var strm = this.OpenFile(this.detailsFilename) )
          using ( var reader = XmlReader.Create(strm) )
               return detailsSerializer.Read(reader);
     }

Is there already a way to introduce a parameter for "this.detailsFilename"
while leaving every caller of this method untouched by introducing an
overload without the new parameter at the very same time?


Still very quick:
1. "introduce variable" (ctrl-R+V) at "this.detailsFilename"

2. "extract method" (ctrl-R+M) at everything below the new variable
optional 3. "inline variable" at the new variable

--
/\/\arkus.

0

Please sign in to leave a comment.