Skip to main content

Interface IMessage

Marker interface that designates a type as an event payload in the publish/subscribe bus.

public interface IMessage

Remarks​

Using a marker interface rather than object as the message base type serves two purposes. First, it gives the type system a vocabulary — any class or struct that carries this interface is unambiguously an event payload, not an arbitrary object. Second, the IEventAggregator explicitly blocks subscribing to IMessage itself (the bare base type), which prevents accidental catch-all subscriptions that would receive every event in the system.

Message types are intentionally plain data containers with no behaviour. Keeping them thin ensures that the same message can be re-published or inspected without side effects.