C# (not ASP/MVC/WinForms) - Catch all exceptions in a class

后端 未结 3 1410
隐瞒了意图╮
隐瞒了意图╮ 2021-02-07 03:31

Some background info

I am programming in a system that uses a proprietary programming language, with the option of using specially attributed .Net classes in the propri

3条回答
  •  孤独总比滥情好
    2021-02-07 03:44

    I would take a look at using something like Castle Dynamic Proxy.
    This will allow your class method calls to be intercepted in a generic way, which would give you a central place to put a "catch-all" exception handler. (That said, it's unclear to me how your classes are actually instantiated, which might make this approach problematic)

提交回复
热议问题