Overhead of try/finally in C#?

后端 未结 6 1254
有刺的猬
有刺的猬 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:30

    So let's assume there's an overhead. Are you going to stop using finally then? Hopefully not.

    IMO performance metrics are only relevant if you can choose between different options. I cannot see how you can get the semantic of finally without using finally.

提交回复
热议问题