Quantcast
Channel: patterns & practices: Prism
Viewing all articles
Browse latest Browse all 1878

New Post: subscribe to an event with a generic argument

$
0
0

Hello 

I have an event that uses an eventarg class that has a generic parameter. I want to publish this event and have the subscriber act on the generic parameter that was passed.

on the Publish side I have this:

PublishPrismEvent.Publish(new PrismPublishEventArgs<TPayload>(this.MethodName,this.TargetName, argument));

"argument" is defined as a generic parameter in the PrismPublishEventArgs class. On the subscribe side, I wish to subscribe to this event and then analyze that generic parameter using reflection, for example, in the event handler. I have:            

PrismPublishEvent PrismInternalPublishEvent = EventAggregator.GetEvent<PrismPublishEvent>(); PrismInternalPublishEvent.Subscribe(PrismInternalPublishEventHandler, ThreadOption.UIThread, false);

but it is throwing an error saying "Incorrect number of type parameters in reference to class PrismPublishEvent<T>"This should be doable... any help would be greatly appreciated. 

Thanks

Harold


Viewing all articles
Browse latest Browse all 1878

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>