C#: Find all empty catch blocks

前端 未结 9 1289
逝去的感伤
逝去的感伤 2020-12-23 22:08

I am reviewing some code.

I have notice some empty catch blocks. Not a good idea since somethings do not work and you cannot see why.

Is there an easy way to

9条回答
  •  醉梦人生
    2020-12-23 22:44

    Here is a regular expression that finds also catch blocks with only comments inside :

    catch:b*\([^)]*\)[:b\n]*\{([:b\n]|(\/\*[^*]*\*\/)|(//[^\n]*))*\}
    

提交回复
热议问题