Back to results for “Events & Lambdas”
C# › Delegates, Events & Lambdas

What is the difference between multicast delegate invocation and exception handling?

Advanced

Answer

A multicast delegate invokes subscribers in order; if one throws, later subscribers are skipped and the exception propagates. Invoke manually via GetInvocationList to isolate failures.
foreach (var d in handler.GetInvocationList().Cast<Action>())
    try { d(); } catch (Exception ex) { Log(ex); }
Real-world example Notifying many listeners where one failing listener must not block the rest.