Only a class derived
from System.Exception
can be used to represent an exception.
Like Java but unlike C++,
C#'s try statement has an optional finally clause.
When a try statement gets executed,
the final piece of code to be executed
will be the statements of the finally clause.
These statements will be executed
no matter whether an exception has occurred or not.
There is one important difference from Java.
Suppose the code of a method includes a statement that can
cause an exception to occur:
In a .NET language,
it is not necessary (and not possible) to do this.
One consequence is that,
if you wish
a method to catch all the exceptions that its code can throw,
you cannot use the compiler to check whether you are doing this.