Implyzer 2026.5.4
dotnet add package Implyzer --version 2026.5.4
NuGet\Install-Package Implyzer -Version 2026.5.4
<PackageReference Include="Implyzer" Version="2026.5.4" />
<PackageVersion Include="Implyzer" Version="2026.5.4" />
<PackageReference Include="Implyzer" />
paket add Implyzer --version 2026.5.4
#r "nuget: Implyzer, 2026.5.4"
#:package Implyzer@2026.5.4
#addin nuget:?package=Implyzer&version=2026.5.4
#tool nuget:?package=Implyzer&version=2026.5.4
Implyzer
Implyzer is a Roslyn source generator and analyzer that enforces implementation constraints on interfaces.
It allows you to specify whether an interface should be implemented only by classes (reference types) or
structs (value types), and can even enforce a specific base class.
Features
- Enforce Implementation Type: Restrict interface implementations to be strictly
classorstruct. - Enforce Base Class: Require implementing classes to inherit from a specific base type.
- Enforce Indirect Implementation: Make some interfaces directly unimplementable by classes, while still allowing them to be implemented through other interfaces.
- Static Abstract Members: Support
static abstractinterface methods with zero-overhead native execution on C# 11+ and automatic simulation fallback on older target frameworks. - Zero-Config: Works out-of-the-box with standard .NET projects.
- Source Generator: Automatically injects the necessary attributes into your project—no extra dependencies are required at runtime.
Installation
.csproj
<ItemGroup>
<PackageReference Include="Implyzer" Version="*" OutputItemType="Analyzer" ReferenceOutputAssembly="false">
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>
Dotnet CLI
dotnet add package Implyzer --version 1.1.0
Package Manager Console
NuGet\Install-Package Implyzer -Version 1.1.0
File-based Reference
#:package Implyzer@1.1.0
Examples
1. Enforce Reference Types (Classes)
Use [ImplType(ImplKind.ReferenceType)] to ensure an interface is only implemented by classes.
using Implyzer;
[ImplType(ImplKind.ReferenceType)]
public interface IService
{
void Execute();
}
// VALID: Class implements the interface
public class MyService : IService
{
public void Execute() { }
}
// ERROR: Struct cannot implement ReferenceType interface
public struct MyStruct : IService
{
public void Execute() { }
}
2. Enforce Value Types (Structs)
Use [ImplType(ImplKind.ValueType)] to ensure an interface is only implemented by structs.
using Implyzer;
[ImplType(ImplKind.ValueType)]
public interface IData
{
int Value { get; }
}
// VALID: Struct implements the interface
public struct Point : IData
{
public int Value => 10;
}
// ERROR: Class cannot implement ValueType interface
public class DataObject : IData
{
public int Value => 10;
}
3. Enforce Base Class
Use [ImplType(typeof(MyBaseClass))] to ensure implementing classes inherit from a specific base class. This
implicitly enforces ImplKind.ReferenceType.
using Implyzer;
public class GameEntity { }
[ImplType(typeof(GameEntity))]
public interface IEnemy { }
// VALID: Inherits from GameEntity
public class Zombie : GameEntity, IEnemy { }
// ERROR: Does not inherit from GameEntity
public class Player : IEnemy { }
4. Enforce Indirect Implementation
Enforce indirect implementation by using [IndirectImpl].
using Implyzer;
[IndirectImpl(typeof(IGeneric<>))]
public interface INotGeneric { }
public interface IGeneric<T> { }
// VALID: Inherits from IGeneric
public class Generic : IGeneric<int> { }
// ERROR: Inherits from INotGeneric
public class NotGeneric : INotGeneric { }
5. Static Abstract Interface Support
Declare static abstract methods on interfaces using [StaticAbstract]. On C# 11+ / .NET 7+, Implyzer emits native static abstract interface members with zero-overhead calls; on older targets, it automatically generates companion routing helpers.
using Implyzer;
public delegate bool TryParse<T>(string input, out T? result);
[StaticAbstract(nameof(TryParse), typeof(TryParse<>), "TSelf", "T")]
public partial interface IParser<TSelf> where TSelf : IParser<TSelf> { }
public class Color : IParser<Color>
{
public static bool TryParse(string input, out Color? result)
{
result = new Color();
return true;
}
}
// Call via generated companion class:
var success = IParser.TryParse<Color>("red", out var color);
How It Works
- The package includes a Source Generator that adds the
ImplTypeAttributeandImplKindenum to your project automatically. - The Analyzer inspects your code at compile-time and reports errors (
IMPL001for kind mismatch,IMPL002for base type mismatch) if the constraints are violated.
Building from Source
Requirements: .NET 10.0 SDK or later.
- Clone the repository.
- Build the solution:
dotnet build - Run tests:
dotnet test
License
MPL-2.0
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages (3)
Showing the top 3 NuGet packages that depend on Implyzer:
| Package | Downloads |
|---|---|
|
NeoKolors.Common
the common utilities for the NeoKolors library pack |
|
|
NeoKolors.Settings
Package Description |
|
|
IParsablePolyfill
A polyfill for IParsable |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.5.4 | 519 | 9/13/2026 |
| 2026.5.3.1 | 151 | 9/12/2026 |
| 2026.5.3 | 180 | 9/7/2026 |
| 2026.5.2.2 | 174 | 9/6/2026 |
| 2026.5.2.1 | 116 | 9/6/2026 |
| 2026.5.2 | 124 | 9/6/2026 |
| 2026.5.1 | 127 | 9/5/2026 |
| 2026.5.0 | 131 | 9/5/2026 |
| 2026.4.4 | 162 | 7/22/2026 |
| 2026.4.3 | 128 | 7/4/2026 |
| 2026.3.1 | 185 | 6/13/2026 |
| 2026.1.0 | 847 | 3/23/2026 |