开发者

Does making a class NotInheritable in VB.NET offer the same (potential) compiler optimizations as sealed in C#?

开发者 https://www.devze.com 2022-12-16 14:58 出处:网络
I\'ve read that making a class sealed in C# is advisable in high-performance scenarios because it frees the compiler to make certain optimizations (e.g., inlining property getters) that it wouldn\'t b

I've read that making a class sealed in C# is advisable in high-performance scenarios because it frees the compiler to make certain optimizations (e.g., inlining property getters) that it wouldn't be able to make otherwise. Is the same true for NotInheritable in VB.NET? My guess would be yes, but I'm posting this question in case someone else has already investigated 开发者_如何学运维and happens to know the answer.


Yes, the generated IL for sealed in C# is identical to NotInheritable in VB.NET and those potential optimizations will be done by the JIT compiler which will happen regardless of the original language.

0

精彩评论

暂无评论...
验证码 换一张
取 消