Sealant 1.0.0-alpha.2

This is a prerelease version of Sealant.
dotnet add package Sealant --version 1.0.0-alpha.2
                    
NuGet\Install-Package Sealant -Version 1.0.0-alpha.2
                    
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="Sealant" Version="1.0.0-alpha.2">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Sealant" Version="1.0.0-alpha.2" />
                    
Directory.Packages.props
<PackageReference Include="Sealant">
  <PrivateAssets>all</PrivateAssets>
  <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets>
</PackageReference>
                    
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 Sealant --version 1.0.0-alpha.2
                    
#r "nuget: Sealant, 1.0.0-alpha.2"
                    
#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 Sealant@1.0.0-alpha.2
                    
#: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=Sealant&version=1.0.0-alpha.2&prerelease
                    
Install as a Cake Addin
#tool nuget:?package=Sealant&version=1.0.0-alpha.2&prerelease
                    
Install as a Cake Tool

Sealant

Sealant

NuGet version

CI InferSharp Lint Spell check

Sealant is a .NET source code analysis package, developed by humans, that reports a compiler warning whenever a class is not sealed, static, abstract, or marked unsealed, and includes code fixes that add sealed or an unsealed comment.

Platform support: any project built with .NET SDK 7.0 or later, for any target framework.

Quick start

If your IDE supports .NET source code analysis, it shows a warning for each class that is not sealed, static, abstract, or marked unsealed. Build your project to see the same warnings from the command line. The package only provides .NET source code analysis and code fixes, and adds no runtime dependency to your project.

Why

Inheritance is sometimes the right approach, but far less often than its prevalence suggests. Alan Kay, who coined the term object-oriented programming, put it this way:

Unfortunately, inheritance—though an incredibly powerful technique—has turned out to be very difficult for novices (and even professionals) to deal with.

— Alan Kay, The Early History of Smalltalk (1993)

Inheritance is powerful, but it is also a commitment. Once someone derives from a type, changing that type becomes harder, and closing the type later is a breaking change.

Jamie Zawinski's old joke about regular expressions applies with one substitution:

Some people, when confronted with a problem, think "I know, I'll use inheritance." Now they have two problems, and a base class they can never change.

— after Jamie Zawinski

Tutorials do not help: the standard example is still an Animal, a Dog, and a Cat—a hierarchy that exists nowhere else.

The default should make closing a type the easy path, not the afterthought.

Some languages already work this way. Kotlin classes are final by default, and open makes them inheritable. Swift requires open to subclass a class outside its defining module. C# takes the opposite default: its classes are inheritable by default. Unless the author remembers to choose sealed, static, or abstract, a class invites subclasses it was never designed for.

Jeffrey Richter, in CLR via C#, argues that the default is the wrong way round:

When defining a new type, compilers should make the class sealed by default so that the class cannot be used as a base class. ... Obviously, it is too late now, but I think that today's compilers have chosen the wrong default and it would be nice if it could change with future compilers.

— Jeffrey Richter, CLR via C#

Sealant removes inheritance by default, making it deliberate, not accidental.

Rules

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last Updated
1.0.0-alpha.2 46 11/22/2026
1.0.0-alpha.1 154 11/19/2026