Blake11.AutoInterface 1.0.18

dotnet add package Blake11.AutoInterface --version 1.0.18
                    
NuGet\Install-Package Blake11.AutoInterface -Version 1.0.18
                    
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="Blake11.AutoInterface" Version="1.0.18" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Blake11.AutoInterface" Version="1.0.18" />
                    
Directory.Packages.props
<PackageReference Include="Blake11.AutoInterface" />
                    
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 Blake11.AutoInterface --version 1.0.18
                    
#r "nuget: Blake11.AutoInterface, 1.0.18"
                    
#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 Blake11.AutoInterface@1.0.18
                    
#: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=Blake11.AutoInterface&version=1.0.18
                    
Install as a Cake Addin
#tool nuget:?package=Blake11.AutoInterface&version=1.0.18
                    
Install as a Cake Tool

.NET NuGet NuGet

AutoInterface

Yet another source generator that creates interfaces for implementations and auto-implements the said interface.

How it works

Define a partial class with some public methods

public class MyService
{
    public void HelloWorld()
}

Add [AutoInterface] attribute and make it partial

[AutoInterface]
public partial class MyService
{
    public void HelloWorld()
}

Now you can use the interface

IMyService service = new MyService();

How it works

Scanning

Source generator will scan the project for partial classes with [AutoInterfaceAttribute]

Found classes will be analyzed for public methods, generic arguments and generic argument constrains

Generation

For matching types there will be generated 2 components:

  1. An interface with the classes name
  2. A partial class implementing your interface

Supports:

  • public methods
  • methods with parameter modifiers
  • generic class arguments
  • generic class type constrains
  • generic method arguments
  • generic method type constraints

Not supported yet:

  • docs
  • explicit interface name, namespace
  • nullable parameters
  • probably a bunch more

FAQ:

1. Should I use AutoInterface?

A: Probably not but in some cases it would help.

There are no supported framework assets in this package.

Learn more about Target Frameworks and .NET Standard.

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.18 161 12/19/2024
1.0.15 153 12/19/2024
1.0.1 151 12/19/2024
1.0.0 148 12/19/2024