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

后端 未结 8 924
余生分开走
余生分开走 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
    2021-01-13 02:27

    Microsoft's Design Guidelines for Developing Class Libraries is a very valuable resource. Here is a relevant article:

    Exceptions and Performance

    I would also recommend the Framework Design Guidelines book from Microsoft Press. It has a lot of the information from the Design Guidelines link, but it is annotated by people with MS, and Anders Hejlsberg, himself. It gives a lot of insight into the "why" and "how" of the way things are.

提交回复
热议问题