Under C# how much of a performance hit is a try, throw and catch block

前端 未结 8 627
孤街浪徒
孤街浪徒 2020-12-15 22:07

First of all, a disclaimer: I have experience in other languages, but am still learning the subtleties of C#

On to the problem... I am looking at some code, which u

8条回答
  •  渐次进展
    2020-12-15 22:41

    Try / Catch / Throw are slow - a better implementation would be to check the value before catching it, but if you absolutly can't continue, you are better off throwing and catching only when it counts. Checking and logging is more efficient otherwise.

提交回复
热议问题