开发者

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.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜