Using Exceptions throwing in C#. Does it affect a performance?

后端 未结 8 951
余生分开走
余生分开走 2021-01-13 01:58

Basically, the question is: Do the Exceptions in C# affect the performance a lot? Is it better to avoid Exceptions rethrow? If i generate an exception in my code, does it a

8条回答
  •  慢半拍i
    慢半拍i (楼主)
    2021-01-13 02:42

    Exceptions as its name implies are intended to be exceptional. Hence you can't expect them to have been an important target for optimisation. More often then not they don't perform well since they have other priorites such as gathering detailed info about what went wrong.

提交回复
热议问题