The order of the exception-handling blocks is important. .NET scans the list of Catch blocks from top to bottom and only fires the code in the first block that matches a specifi c type of exception. In the preceding example, when an SmtpException occurs (which is a subclass of Exception), it will be caught by the Catch block that handles exceptions of type SmtpException. Although an SmtpException is also an Exception, the code in the last Catch block won’t be fired anymore because only the fi rst matching Catch block is handled. Therefore, if you reverse the order of the Catch blocks in this example, the more generic Exception block would be executed, and the code in
the SmtpException block would never run.