How sealed Class Improve performance
Can any one tell me how sealed class improve performance in C sharp?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
VulpesPosted Mar 15, 2011, 6:42 AM
VulpesPosted Mar 15, 2011, 1:50 PM
If you're writing a library for others to use, then a more important consideration is whether it's a good idea to allow them to inherit from your classes - sometimes it isn't and you'll therefore find that some classes in the .NET framework itself are sealed.
As well as making a whole class sealed, you can also seal an 'override' method in isolation to prevent further overriding. Again this would usually be done for design rather than performance reasons.
Rahul ShahPosted Mar 15, 2011, 1:22 PM
VulpesPosted Mar 15, 2011, 1:20 PM
Rahul ShahPosted Mar 15, 2011, 1:01 PM
VulpesPosted Mar 15, 2011, 9:10 AM
For example the following compiles fine:
Rahul ShahPosted Mar 15, 2011, 8:47 AM