ASP.NET C# Catch all exceptions in a class

前端 未结 5 796
我在风中等你
我在风中等你 2021-01-30 12:05

I know this is not the way to do it, and it isn\'t clean at all. I just wonder if it\'s possible.

If I have a class with a bunch of methods

public class          


        
5条回答
  •  刺人心
    刺人心 (楼主)
    2021-01-30 12:36

    No, there isn't. try/catch blocks can only occur in methods. You could use some sort of AOP framework however to automatically generate those blocks. postcrap is a pretty lightweight AOP component.

提交回复
热议问题