Best practices for catching and re-throwing .NET exceptions

前端 未结 11 1598
野的像风
野的像风 2020-11-22 07:15

What are the best practices to consider when catching exceptions and re-throwing them? I want to make sure that the Exception object\'s InnerException

11条回答
  •  孤城傲影
    2020-11-22 08:02

    When you throw ex, you're essentially throwing a new exception, and will miss out on the original stack trace information. throw is the preferred method.

提交回复
热议问题