It seems like there are some real benefits to be gained by marking classes as sealed:
- Performance in some cases
- Compile-time type safety in other special cases Explicit conversion fails for sealed class
- Preventing unintended inheritance of your classes
And there seems relatively little in the way of disadvantages...you can unseal a class without breaking code, but you can't later seal a class that was unsealed without breaking code.
Is it best practice to always mark a class sealed unless you intend for it to be inherited from? Why or why not?
Any other comments or guidance on this topic?