I often catch my self thinking that I miss something like the following in C#:

send new MyMessage();

The line should work just like “throw”, but instead of stopping the execution of the code and looking for a handling catch block up in the stack, I would like a pluggable architecture for processing messages, so that you can mark a method to handle the message. “Send” can be used to pass messages to the upper levels, without events if those are unwanted.

It will also be very cool if it will be a way to tell the framework to call the handler in either way: synchronous or asynchronous.

Well, yes, I know about the events, but those are noisy for passing simple messages.

I remember Jeremy D. Miller asked if it’s the time to put DI into the BCL. So it’s seems like there is some need for putting the “Decoupled” way of doing things right into the platform.

It’s just a random thought crossed my mind :). And no, I will not go that far and say that I want to see macros support in C#.

As for now - the simplest thing that actually works:

DomainEvents.Raise(new MyMessage());