Does IEventAggregator subscribe multiple times?
If I have the following Microsoft.Practices.Prism.Events.IEventAggregator instan开发者_StackOverflow社区ce:
eventAggregator.GetEvent<MyEvent>.Subscribe(SomeMethod);
and the above line of code is hit multiple times, does EventAggregator check if there is already a subscribtion or will this keep subscribing and fire multiple times (everytime) for a single Publish()?
It should subscribe multiple times. The Subscribe
method returns a SubscriptionToken
which should be distinct even if you use the call the Subscribe
with the same method multiple times, allowing you to remove a distinct reference if you choose to do so.
精彩评论