Removing excessive try-catch blocks

前端 未结 8 2391
Happy的楠姐
Happy的楠姐 2021-02-14 19:10

I\'m refactoring a medium-sized WinForms application written by other developers and almost every method of every class is surrounded by a try-catch block. 99% of t

8条回答
  •  一整个雨季
    2021-02-14 19:23

    You may try to use AOP.

    In AOP through PostSharp, for example, you can handle exceptions in one central place (piece of code) as an aspect.

    Look at the examples in documentation to have an idea => Docs on Exception Handling with PostSharp.

提交回复
热议问题