Showing posts with label Multiple Catch Blocks for Try Block in C#. Show all posts
Showing posts with label Multiple Catch Blocks for Try Block in C#. Show all posts

Thursday, 24 May 2018

Multiple Catch Blocks for Try Block in C#



              In this article, I would like to know you about multiple catch blocks for try block.
Actually the Exception class is the super class for all the exceptions, so this Exception class catch block should be at end of all catch blocks, if not it shows an error message at compile time only i.e., A previous catch clause already catches all exceptions of this or of a super type ('Exception').
So that to avoid compile time errors, we have to set the order of different exception catch blocks.