How do I create a generic method with a generic in the where clause? (Man that's clear as mud!)
- by Jordan
Is there a way of doing this:
protected void SubscribeToEvent<TEvent, TPayload>(Action<TPayload> a_action)
where TEvent : CompositePresentationEvent<TPayload>
{
TEvent newEvent = _eventAggregator.GetEvent<TEvent>();
SubscriptionToken eventToken = newEvent.Subscribe(a_action);
_lstEventSubscriptions.Add(new KeyValuePair<EventBase, SubscriptionToken>(newEvent, eventToken));
}
without requiring the user to specify a TPayload parameter?