Overhead of try/finally in C#?

后端 未结 6 1275
有刺的猬
有刺的猬 2020-12-07 23:47

We\'ve seen plenty of questions about when and why to use try/catch and try/catch/finally. And I know there\

6条回答
  •  臣服心动
    2020-12-08 00:31

    What Andrew Barber said. The actual TRY/CATCH statements add no/negligible overhead unless an exception is thrown. There's nothing really special about finally. Your code just always jumps to finally after the code in the try+catch statements are done

提交回复
热议问题