Seal more internal/private classes #160
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR enables per CA1852 and CA1813 as suggestions. We can also alternatively enable entire performance category analyzers. I went through some of the internal and private types and sealed them, unsealing them later is easy as is it is not a breaking change.
You can read more about potential benefits by sealing internal/private classes by default here: dotnet/runtime#49944
note: skimming through usage of the classes I sealed, the benefits sealing are negligible at best as very few is stored in arrays (we would avoid covariance checks) or having virtual call dispatches.. However the concrete attributes should benefit from sealing and I think it's good pratice to seal any private or internal class with no-derived types by default as unsealing it later is free.