Skip to content

Frederik91/MakeInterface

Repository files navigation

MakeInterface

Creates an interface of a class using source generator

.NET

Usage

Add the attribute to the class you want to generate the interface for

[GenerateInterface]
public class MyClass
{
	public string MyProperty { get; set; }
	public void MyMethod() { }
}

The generated interface will then be generated as IMyClass.g.cs

public interface IMyClass
{
	string MyProperty { get; set; }
	void MyMethod();
}

You can then implement the interface in your class

public class MyClass : IMyClass
{
	public string MyProperty { get; set; }
	public void MyMethod() { }
}

Installation

Install the NuGet package MakeInterface

You can either create the attribute yourself or use the one provided in the package MakeInterface.Contracts

License

MIT

About

Generates interface for class

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages 4

 
 
 
 

Languages