How to specify an IMethod as the callback for an event?
I'd like to specify an introduced method on a TypeAspect as the callback for an event handler.
1) When I attempt to just pass it in via a template, I get squigglies:
dictionary.OnDictionaryChanged += myDictionaryChangedMethod; //Doesn't like this since IMethod isn't a System.EventHandler
2) How can I similarly remove the event in a subsequently introduced Dispose() method?
Thank you!
3 Replies
Good point. We haven't thought about this point.
It seems you need a StatementBuilder for now.
GitHub
Feature: reference IMethod as a delegate in a template · Issue #184...
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&#...
Always an excellent fallback those StatementBuilders - thank you!
Closing as this has a Github ticket now