Interface IEventAggregator
Publishes messages to subscribers without the publisher and the subscribers referencing each other.
public interface IEventAggregator
Remarks
A message reaches the subscribers registered for exactly its type T and the same key.
Methods
Publish<T>(T, string)
Publishes a message to all subscribers of type T and the given key.
void Publish<T>(T objectToSend, string key = null)
Parameters
objectToSendTThe message to send.
keystringAn optional key that selects the channel; null means the default channel.
Type Parameters
TThe message type.
Reset()
Removes all subscriptions.
void Reset()
Subscribe<T>(Action<T>, string)
Subscribes an action to messages of type T.
void Subscribe<T>(Action<T> action, string key = null)
Parameters
actionAction<T>The action to invoke when a message is published.
keystringAn optional key that narrows the subscription to a channel; null means the default channel.
Type Parameters
TThe message type.
Unsubscribe<T>(Action<T>, string)
Removes a subscription that was added with Subscribe<T>(Action<T>, string).
void Unsubscribe<T>(Action<T> action, string key = null)
Parameters
Type Parameters
TThe message type.