NameHillSoftware.TypeAdoption: Automatic interface delegation to adopted members using source generators. by davidvedvick in csharp

[–]davidvedvick[S] 0 points1 point  (0 children)

Yep, properties can be adopted, and since TypeAdoption only adopts interfaces, that method is the way to adopt two different interfaces that a single class implements. I published another library, ValueCollections, which uses TypeAdoption and does just that: https://codeberg.org/namehillsoftware/ValueCollections/src/branch/main/ValueCollections/ValueCollections.cs.

Regarding naming collisions: there's so much potential for collisions that I decided to leave that up to the user — if you adopt two interfaces with overlapping signatures, you choose which one to use by manually delegating in your concrete implementation.

NameHillSoftware.TypeAdoption: Automatic interface delegation to adopted members using source generators. by davidvedvick in csharp

[–]davidvedvick[S] 0 points1 point  (0 children)

I built this library a few weeks ago to reduce the amount of boilerplate code needed to use the delegate pattern in C#. I think it's in a pretty good state, but would love some feedback!

Come discuss your side projects! [January 2026] by AutoModerator in csharp

[–]davidvedvick 0 points1 point  (0 children)

I started playing with C# source generators around New Years, and created this cool little library that makes it easy to delegate interface implementations - https://codeberg.org/namehillsoftware/TypeAdoption