I have many code styles specified in my .editorconfig file for my C# projects. I would find really useful if all of my classes could be sealed by default (When you create a new one) or at least they would show warning there class is not sealed. Is there a setting for this in the .editorconfig file ?
PS: Please dont explaint if it is/isnt a good idea, there are many such threads on SO, so it would be redundant.
There are also some
.editorconfigpreferences, but they work only after installing Meziantou.Analyzer Nuget package into your project. After you build your solution these sealed suggestions will show up.Source: https://www.meziantou.net/performance-benefits-of-sealed-class.htm
[2023] .NET 7 EDIT:
Now .NET 7 allows you to specify this warning in
.editorconfiglike:But it has one requirement, it works only on
internalclassesSource: https://learn.microsoft.com/en-us/dotnet/fundamentals/code-analysis/quality-rules/ca1852