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!
Gael Fraiteur
Gael Fraiteur302d ago
Good point. We haven't thought about this point. It seems you need a StatementBuilder for now.
Gael Fraiteur
Gael Fraiteur302d ago
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&#...
Xaniff
Xaniff290d ago
Always an excellent fallback those StatementBuilders - thank you! Closing as this has a Github ticket now
Want results from more Discord servers?
Add your server
More Posts
Create NuGet with MetalamaWith source generators I have to add some MSBuild configuration, but with Metalama it seems I don't Override property with BuildAspectI create exceptions inheriting from Exception and putting the `[BusinessException]` attribute. I waView diff in RiderI don't use Visual Studio, and overall, I don't have Windows. Is there any way to see the source genOverride constructorIs it possible to override a constructor? I want to take my code: ``` public class BusinessExceptiDoes Metalama only support attributes?I navigated in all Metalama documentation, but I want to override a method for all types that inheriCan Metalama suppress compiler errors?Hello! I want to know if I can use Metalama in my library. The users of my library have to declare Eligibility rule based on target method not returning voidTypically eligibility rules I've put together are based on a specifically typed return or paramters.Follow up question from yesterday's meetupNow that I've had time to review what was discussed I think I can now ask the question I'd wanted toPlease cache licensing key rather than check every buildEvery time I attempt to build an aspect today, I'm getting an error that I've got an invalid licenseDocumentation: Bad linkAt https://doc.metalama.net/conceptual/using/fabrics there's a link at the bottom titled "ConfigurinCan one pass state between aspects?One can trivially pass arbitrary data between the aspect class and a template via the 'args' parametOrdering AspectsIn the documentation it states: 'Aspects must be ordered using the AspectOrderAttribute assembly-lev