When is a method eligible to be inlined by the CLR?

前端 未结 5 1323
盖世英雄少女心
盖世英雄少女心 2020-11-30 03:23

I\'ve observed a lot of \"stack-introspective\" code in applications, which often implicitly rely on their containing methods not being inlined for their correctnes

5条回答
  •  孤街浪徒
    2020-11-30 03:43

    While Hans' answer is correct, there is one omission, not necessarily about when a method is eligible for inlining, but when a method is not.

    Abstract and virtual methods are not eligible for inlining in the CLR.

    It's important to note as it whittles down the conditions under which a method may be inlined.

提交回复
热议问题