0

According to the design guideline the catching exception should start from more specification exception to System.Exception.

like :

try
{


}
catch(IOException IOEx)
{
}
catch(ArrayIndexOutOfRangeException AIE)
{
}
.....
catch(Exception ex)
{
}

I heard that CLR tracks the stack to trace the exception one by one to find the matching one(if an error occur). As stack is "Last in first out" in nature won't CLR look in reverse order ? ( i.e Exception .. ArrayIndexOutOfRangeException .. IOException)

1 Answer 1

4

No - the stack in this case is the call stack, so if it doesn't find a handler in the current method, it will move up the stack to look for a handler. Within a particular method however, handlers are tested in the order they are specified.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.