O'Reilly logo

From Java to C#: A Developer's Guide by Heng Ngee Mok

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

14.5. Exception throwing in delegates

When a delegate instance is invoked, and an unhandled exception occurs in one of the methods on the instance's invocation list, the remaining methods will not be invoked and the exception is thrown to the delegate instance's context (see Figure 14.4). The diagram shows the scenario whereby a delegate instance contains five methods in its invocation list. When this instance is invoked, Method1 and Method2 are invoked in turn. Let's assume that when Method3 is invoked, an unhandled exception occurs. As a result, Method4 and Method5 will not execute and the exception object is thrown to the delegate instance's context.

Figure 14.4. Method4 and Method5 will not execute if an exception occurs when Method3 is invoked. ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required