Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: reference IMethod as a delegate in a template #184

Open
gfraiteur opened this issue Jul 21, 2023 · 5 comments
Open

Feature: reference IMethod as a delegate in a template #184

gfraiteur opened this issue Jul 21, 2023 · 5 comments
Labels
enhancement New feature or request

Comments

@gfraiteur
Copy link
Member

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
@PostSharpBot
Copy link
Member

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.

@WhitWaldo
Copy link

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!

@svick svick added the enhancement New feature or request label Jul 21, 2023
@gfraiteur
Copy link
Member Author

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.

@WhitWaldo
Copy link

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.

@gfraiteur
Copy link
Member Author

Raising the priority of this ticket because it seems both forgotten, simple, and good value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

4 participants