-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
36 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,36 @@ | ||
# AutoAs | ||
# AutoAs | ||
|
||
C# [Source Generator](https://github.com/dotnet/roslyn/blob/master/docs/features/source-generators.md) which generates fluent AsInterface cast-methods for all interfaces type implements. | ||
<br> | ||
|
||
Manually written source: | ||
|
||
```csharp | ||
|
||
public interface IPrintable | ||
{ | ||
} | ||
|
||
[BeaKona.AutoAs] | ||
public partial class Person : IPrintable | ||
{ | ||
} | ||
``` | ||
|
||
Auto-generated accompanying source: | ||
|
||
```csharp | ||
partial class Person | ||
{ | ||
public IPrintable AsPrintable() => this; | ||
} | ||
``` | ||
<br> | ||
|
||
Other examples can be found in [wiki](https://github.com/beakona/AutoAs/wiki/Examples). | ||
|
||
<br> | ||
--- | ||
|
||
![.NET Core](https://github.com/beakona/AutoAs/workflows/.NET%20Core/badge.svg) | ||
[![NuGet](https://img.shields.io/nuget/v/BeaKona.AutoAsGenerator)](https://www.nuget.org/packages/BeaKona.AutoAsGenerator) |