It is done using Delegate.Combine
static method.
SomeDelegate c = Delegate.Combine(a, b) as SomeDelegate;
When using +=
operator it is just the same actually.
// This is the same...
eventSource.onEvent += OnEvent;
// ...as this.
eventSource.onEvent = Delegate.Combine(
eventSource.onEvent,
Delegate.CreateDelegate(typeof(EventSource.OnEvent), this, "OnEvent")
) as EventSource.OnEvent;
MulticastDelegate
class (the class behind delegate
keyword) do have a list of invocations, but this list is immutable. Each time you combine delegates with the +=
operator, a new MulticastDelegate
instance get created combining the invocation list of the former two Delegate objects.