4thSpace
4thSpace

Reputation: 44312

Does IEventAggregator subscribe multiple times?

If I have the following Microsoft.Practices.Prism.Events.IEventAggregator instance:

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()?

Upvotes: 1

Views: 1789

Answers (1)

casperOne
casperOne

Reputation: 74530

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.

Upvotes: 3

Related Questions