Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/Frederik91/MakeInterface
Generates interface for class
https://github.com/Frederik91/MakeInterface
Last synced: about 1 month ago
JSON representation
Generates interface for class
- Host: GitHub
- URL: https://github.com/Frederik91/MakeInterface
- Owner: Frederik91
- License: mit
- Created: 2022-12-15T21:14:21.000Z (almost 2 years ago)
- Default Branch: master
- Last Pushed: 2024-01-25T12:15:17.000Z (11 months ago)
- Last Synced: 2024-08-01T22:43:22.866Z (4 months ago)
- Language: C#
- Size: 82 KB
- Stars: 2
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: readme.md
- License: LICENSE.txt
Awesome Lists containing this project
- RSCG_Examples - https://github.com/Frederik91/MakeInterface
README
# MakeInterface
Creates an interface of a class using source generator[![.NET](https://github.com/Frederik91/MakeInterface/actions/workflows/dotnet.yml/badge.svg)](https://github.com/Frederik91/MakeInterface/actions/workflows/dotnet.yml)
## Usage
Add the attribute to the class you want to generate the interface for
```csharp
[GenerateInterface]
public class MyClass
{
public string MyProperty { get; set; }
public void MyMethod() { }
}
```The generated interface will then be generated as IMyClass.g.cs
```csharp
public interface IMyClass
{
string MyProperty { get; set; }
void MyMethod();
}
```You can then implement the interface in your class
```csharp
public class MyClass : IMyClass
{
public string MyProperty { get; set; }
public void MyMethod() { }
}
```## Installation
Install the NuGet package [MakeInterface](https://www.nuget.org/packages/MakeInterface.Generator/)You can either create the attribute yourself or use the one provided in the package [MakeInterface.Contracts](https://www.nuget.org/packages/MakeInterface.Contracts/)
## License
MIT