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.
精彩评论