Finding Resharper with template method call

I want to replace this piece of code using "Search with pattern ...":

public bool IsDbObjectsOK()
{
    var result = 0;
    result = usp_IsDbObjectsOK();
    if (result == 0)
        return true;
    return false;
}

public bool UnlockWindow()
{
    var result = 0;
    result = usp_UnlockWindow();
    if (result == 0)
        return true;
    return false;
}

      

Replaced by:

public bool IsDbObjectsOK()
{
    return usp_IsDbObjectsOK() == 0;
}

public bool UnlockWindow()
{
    return usp_UnlockWindow() == 0;
}

      

I tried to use

var $result$ = 0;
$result$ = $usp_IsDbObjectsOK$();
if ($result$ == 0)
    return true;
return false;

      

This doesn't work because the method call was not found in any of the code that needs to be replaced.

How to do it?

+3


source to share


1 answer


When setting up your search, you must make sure to use the placeholder type .



This result

should be the id of the Placeholder, and usp_IsDbObjectsOK

should be the Placement Placement. When I do this, the replacement works as you'd expect.

+2


source







All Articles