"Extract method" to replace 2 occurences?

Hello

I have the following code:
 
public class MasterPageVirtualPathProvider : VirtualPathProvider
{
    public override VirtualFile GetFile(string virtualPath)
     {
        if(virtualPath.StartsWith("masterpage:"))
         {
            // Return the requested file
         }
        return Previous.GetFile(virtualPath);
    }
 
    public override bool FileExists(string virtualPath)
     {
        if(virtualPath.StartsWith("masterpage:"))
         {
            // Check if file exists
         }
        return Previous.FileExists(virtualPath);
    }
}
When I select in the method GetFile() the code with virtualPath.StartsWith("masterpage:") and choose the Extract Method refactoring to introduce a helper method, then ReSharper does not detect that there are multiple occurences. Meaning that the newly created method can also be invoked from within the FileExists() method.
 
Is there a way to do this with ReSharper 4?
 
Cheers
 
Gabriel Lozano-Moran
]]>

1 comment
Comment actions Permalink

Hello Gabriel Lozano-Moran,

No, it is not currently possible. We are going to implement this functionality
sometime in the future.

Sincerely,
Ilya Ryzhenkov

JetBrains, Inc
http://www.jetbrains.com
"Develop with pleasure!"


G> Hello
G>
G> I have the following code:
G>
G> public class MasterPageVirtualPathProvider : VirtualPathProvider
G> {
G> public override VirtualFile GetFile(string virtualPath)
G> {
G> if(virtualPath.StartsWith("masterpage:"))
G> {
G> // Return the requested file
G> }
G> return Previous.GetFile(virtualPath);
G> }
G> public override bool FileExists(string virtualPath)
G> {
G> if(virtualPath.StartsWith("masterpage:"))
G> {
G> // Check if file exists
G> }
G> return Previous.FileExists(virtualPath);
G> }
G> }
G> When I select in the method GetFile() the code with
G> virtualPath.StartsWith("masterpage:") and choose the Extract Method
G> refactoring to introduce a helper method, then ReSharper does not
G> detect that there are multiple occurences. Meaning that the newly
G> created method can also be invoked from within the FileExists()
G> method.
G>
G> Is there a way to do this with ReSharper 4?
G>
G> Cheers
G>
G> Gabriel Lozano-Moran
G>


0

Please sign in to leave a comment.