Feature: reference IMethod as a delegate in a template
There is currently no way to reference an introduced method or an IMethod as a delegate i.e.
dictionary.OnDictionaryChanged += myDictionaryChangedMethod; //Doesn't like this since IMethod isn't a System.EventHandler
Hello @gfraiteur, thank you for submitting this issue. We will try to get back to you as soon as possible. Note to the PostSharp team, this ticket is being tracked in our dashboard under ID TP-33565.
Ideally support for this feature will also be paired with a way to unsubscribe from the event (e.g. within a Dispose or DisposeAsync method) as well - thanks!
An interesting question is: to which delegate type?
It could default to a Func or Action but I guess that in some cases you may want to pass your own delegate type.
I think it'd need to be open to whatever it is that I pass it - my immediate need was to simply provide an Action for a third-party event, meaning I'd have little control over its shape. It could just as easily have required a Func instead.
Raising the priority of this ticket because it seems both forgotten, simple, and good value.