Enable CA1852: Seal internal types#25890
Conversation
25e6142 to
ea67269
Compare
|
/azp run PowerShell-CI-linux-packaging,PowerShell-Windows-Packaging-CI |
|
Azure Pipelines could not run because the pipeline triggers exclude this branch/path. |
|
Why do we bother to do this for internal types? |
|
This allows compiler improve performance by:
|
There’s no drawback to sealing internal types. Unlike public types, where removing the sealed modifier would be a breaking change, internal types don’t carry that risk. |
I guess you mean adding. |
There was a problem hiding this comment.
Thank both of you! I will get this one merged.
FYI, due to the limited resources of the team, we will have to deprioritize the code cleanup PRs in PR reviews. For PRs like this one, the review is easy, so I will take a quick look and merge, but there is no guarantee for those that are more complex and riskier (even with the Approve-LowRisk label). Hope you can understand.
Add sealed modifier to internal types without subtypes.
https://learn.microsoft.com/dotnet/fundamentals/code-analysis/quality-rules/ca1852
Fix #24094.