Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/visual-studio-2012/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Visual studio 在visual studio中删除多行代码_Visual Studio_Visual Studio 2012 - Fatal编程技术网

Visual studio 在visual studio中删除多行代码

Visual studio 在visual studio中删除多行代码,visual-studio,visual-studio-2012,Visual Studio,Visual Studio 2012,在我的整个解决方案中,出现了许多遵循特定模式的代码: try { ... } catch (SqlException ex) { throw new CustomException(ex); } 除了try中的代码外,模式总是完全相同的。我想删除周围的try/catch,并将内部代码留在任何出现这种模式的地方。我可以在这里使用某种搜索/替换吗?您必须使用正则表达式find/replace。您有ReSharper吗?它的结构化搜索和替换功能将非常适合这种情况。

在我的整个解决方案中,出现了许多遵循特定模式的代码:

try
{
   ...
}
catch (SqlException ex)
{
    throw new CustomException(ex);
}

除了try中的代码外,模式总是完全相同的。我想删除周围的try/catch,并将内部代码留在任何出现这种模式的地方。我可以在这里使用某种搜索/替换吗?

您必须使用正则表达式find/replace。您有ReSharper吗?它的结构化搜索和替换功能将非常适合这种情况。