Performance: Mark all classes as sealed where possible #13397
matthewcare
started this conversation in
Features and ideas
Replies: 1 comment
-
Overall, I like the idea.. But you are right it is breaking changes, so we have to announce such changes in the public classes. Seems like a good idea to introduce in the internal classes. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
I've noticed that there have been an increasing number of pull requests for performance based improvements.
An easy performance gain can be achieved by marking relevant classes as
sealed
I won't bother explaining the benefits myself, and will instead link to this article which will do a much better job than I will. (TLDR;
sealed
= good).With .NET 7 a new analyzer was added which can highlight internal classes which can be marked as
sealed
, so that's probably a good place to start.Later on public classes should also be considered, however each public class that is changed will be a breaking change, and therefore not possible until (at time of writing) v13.
What are people's general thoughs on this change?
Beta Was this translation helpful? Give feedback.
All reactions