TastenTiger.Analyzers.Class.SealedByDefault 1.0.0

Requires NuGet 2.12 or higher.

dotnet add package TastenTiger.Analyzers.Class.SealedByDefault --version 1.0.0
                    
NuGet\Install-Package TastenTiger.Analyzers.Class.SealedByDefault -Version 1.0.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="TastenTiger.Analyzers.Class.SealedByDefault" Version="1.0.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="TastenTiger.Analyzers.Class.SealedByDefault" Version="1.0.0" />
                    
Directory.Packages.props
<PackageReference Include="TastenTiger.Analyzers.Class.SealedByDefault" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add TastenTiger.Analyzers.Class.SealedByDefault --version 1.0.0
                    
#r "nuget: TastenTiger.Analyzers.Class.SealedByDefault, 1.0.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package TastenTiger.Analyzers.Class.SealedByDefault@1.0.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=TastenTiger.Analyzers.Class.SealedByDefault&version=1.0.0
                    
Install as a Cake Addin
#tool nuget:?package=TastenTiger.Analyzers.Class.SealedByDefault&version=1.0.0
                    
Install as a Cake Tool

TastenTiger.Analyzers.Class.SealedByDefault

A Roslyn analyzer that ensures that classes and records which are not inherited anywhere are marked as sealed. This promotes clearer design intent, better performance, and safer code.

Get it on Codeberg

Why enforce sealed classes?

  • To prevent unintended inheritance
  • To improve runtime performance
  • To clarify design intent
  • To encourage deliberate API design

What this analyzer does

  • Produces the TA0002 compilation hint when a class or record:
    • is not declared sealed
    • and is not inherited anywhere in the solution
  • Provides a bulk quick fix to automatically add the sealed keyword to the class or record declaration.

Example

public class NotSealedClass // <-- triggers TA0002
{
}

public sealed class SealedClass // <-- compliant
{
}

For more examples, see:
TastenTiger.Analyzers.Class.SealedByDefault.Sample.Examples.cs

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0 0 2/10/2026