Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

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.

like image 807
Dan Tao Avatar asked Jan 11 '10 19:01

Dan Tao


1 Answers

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.

like image 114
mmx Avatar answered Nov 15 '22 06:11

mmx