C#: Throwing Custom Exception Best Practices

前端 未结 8 982
没有蜡笔的小新
没有蜡笔的小新 2020-11-30 01:25

I have read a few of the other questions regarding C# Exception Handling Practices but none seem to ask what I am looking for.

If I implement my own custom Exception

8条回答
  •  天涯浪人
    2020-11-30 02:21

    Have a look at this MSDN-best-practises.

    Consider to use throw instead of throw ex if you want to re-throw caught exceptions, because on this way the original stacktrace keeps preserved(line numbers etc.).

提交回复
热议问题