https://github.com/loic-sharma/interfacegenerator
Automatically generate interfaces for your classes
https://github.com/loic-sharma/interfacegenerator
Last synced: about 2 months ago
JSON representation
Automatically generate interfaces for your classes
- Host: GitHub
- URL: https://github.com/loic-sharma/interfacegenerator
- Owner: loic-sharma
- License: mit
- Created: 2020-05-02T23:09:13.000Z (about 5 years ago)
- Default Branch: master
- Last Pushed: 2020-05-03T03:26:40.000Z (about 5 years ago)
- Last Synced: 2025-04-22T10:44:30.406Z (about 2 months ago)
- Language: C#
- Size: 10.7 KB
- Stars: 14
- Watchers: 2
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: LICENSE
Awesome Lists containing this project
README
# Interface Generator
This is an toy project that uses [C# Source Generators](https://devblogs.microsoft.com/dotnet/introducing-c-source-generators/) to automatically generate the interface for a class. For example:
```csharp
class Program
{
static void Main(string[] args)
{
IFoo x = new Foo();x.Bar("test");
}
}public class Foo : IFoo
{
public void Bar(string name)
{
Console.WriteLine($"Hello {name}");
}
}
```The generator will automatically create `IFoo`:
```csharp
public interface IFoo
{
void Bar(string name);
}
```