int x = 0; int y = 0; int z = 0;
try
{
z = x / y;
}
catch (Exception) // THIS IS NOT A (DECLARATION)!!!!
{
}
C# isn't like Java - you don't have to declare a variable to catch the
exception "into".
From the ECMA spec:
<quote>
When a catch clause specifies a class-type, the type must be
System.Exception or a type that derives from System.Exception.
When a catch clause specifies both a class-type and an identifier, an
exception variable of the given name and type is declared. The
exception variable corresponds to a local variable with a scope that
extends over the catch block. During execution of the catch block, the
exception variable represents the exception currently being handled.
For purposes of definite assignment checking, the exception variable is
considered definitely assigned in its entire scope.
Unless a catch clause includes an exception variable name, it is
impossible to access the exception object in the catch block.
</quote>