Why are try blocks expensive?

前端 未结 11 2436
醉酒成梦
醉酒成梦 2020-12-02 13:13

I\'ve heard the advice that you should avoid try catch blocks if possible since they\'re expensive.

My question is specifically about the .NET platform: Why are try

11条回答
  •  渐次进展
    2020-12-02 13:35

    This is not something I would ever worry about. I would rather care about the clarity and safety of a try...finally block over concerning myself with how "expensive" it is.

    I personally don't use a 286, nor does anyone using .NET or Java either. Move on. Worry about writing good code that will affect your users and other developers instead of the underlying framework that is working fine for 99.999999% of the people using it.

    This is probably not very helpful, and I don't mean to be scathing but just highlighting perspective.

提交回复
热议问题