Catching base Exception class in .NET

前端 未结 16 1968
心在旅途
心在旅途 2020-12-05 19:06

I keep hearing that

catch (Exception ex)

Is bad practise, however, I often use it in event handlers where an operation may for example go

16条回答
  •  夕颜
    夕颜 (楼主)
    2020-12-05 19:26

    No; in that case if you don't want to halt the program there's nothing else you can do and at the top level is the right place to do it, as long as you're logging properly and not hiding it away in hope grin

提交回复
热议问题