7
Contributors
6
Replies
41
Views
4 Years
Discussion Span
Last Post by Ketsuekiame
1

Nothing I believe in the case you have shown, however using the second example you can catch specific kinds of exceptions. For example:

try
{
    //Some code
}
catch(NullReferenceException Ex)
{

}

Would catch any exceptions of type NullReferenceException

0

Your first example catches ALL exceptions. Your second example just catches one specific exception. You can have multiple catch clauses and you can even write your own exceptions derived from the Exception class.

0

Your second example just catches one specific exception.

It catches all exceptions that are a subclass of Exception. Since every exception is a subclass of Exception, that means it catches all exceptions -- just like the first one.

-1

also

try
{
//Some code
}
catch(Exception ex)
{
}

allows you to trap user input errors that you can notify the user of.

0

allows you to trap user input errors that you can notify the user of.

That will catch any exception, not just user input errors.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.