相关疑难解决方法(0)

在"out"参数中传递值类型会导致变量被装箱吗?

我知道拳击和拆箱在性能方面相对昂贵.我想知道的是:

将值类型传递给方法的out参数会导致变量的装箱/取消装箱(从而导致性能下降)吗?编译器可以优化它吗?

  int number;
  bool result = Int32.TryParse(value, out number);
Run Code Online (Sandbox Code Playgroud)

c# performance boxing unboxing

14
推荐指数
3
解决办法
2581
查看次数

标签 统计

boxing ×1

c# ×1

performance ×1

unboxing ×1