小编Wou*_*r D的帖子

使用模式方法调用的 Resharper 搜索

我想使用“使用模式搜索...”替换这部分代码:

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;
}
Run Code Online (Sandbox Code Playgroud)

用。。。来代替:

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

public bool UnlockWindow()
{
    return usp_UnlockWindow() == 0;
}
Run Code Online (Sandbox Code Playgroud)

我试着用

var $result$ = 0;
$result$ = $usp_IsDbObjectsOK$();
if ($result$ == 0)
    return true;
return false;
Run Code Online (Sandbox Code Playgroud)

这不起作用,因为在任何需要替换的代码中都找不到方法调用。

这该怎么做?

c# resharper replace

5
推荐指数
1
解决办法
827
查看次数

标签 统计

c# ×1

replace ×1

resharper ×1