|
|
|
|
|
by UglyToad
690 days ago
|
|
I've been experimenting with this, it makes testing trivial and removes the coupling that inevitably occurs with multi method interfaces. However I think there's one missing enhancement that would turn it from esoteric and difficult to reason about to actually usable that the language will never get. This is being able to indicate a method implements a delegate so that compilation errors and finding references work much more easily. E.g. suppose you have: delegate Task<string> GetEntityName(int id)
public async Task<string> MyEntityNameImpl(int id)
I'd love to be able to mark the method: public async Task<string> MyEntityNameImpl(int id) : GetEntityName
This could just be removed on compile but it would make the tooling experience much better in my view when you control the delegate implementations and definitions. |
|
I'm not sure I understand your use case where you need to conflate the two. You want to enforce the contract but with arbitrary method names?
I suppose you could wire up something like this but it's a bit convoluted.