I know that there is the possibility to use search pattern but I don't know how to implement this feature
You can mark any code in Visual Studio and then click, for example the empty try-catch, then go
Now resharper created a pattern for you matching that code:
try
{
$statement$
}
catch ($Exception$ $e$)
{
}
You can edit it or add new placeholders and save it, then click Find.
In this case it might be a good idea to add another pattern that matches also empty catch blocks that have no Exception
parameter:
try
{
$statement$
}
catch
{
}
By the way, this matches also if the catch contains comments like
// don't do anything
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.