A simple Google search didn't result anything (although I'm not known
for my Google usage skills), but how would I stop the operation when an
exception occurs?
(For example, how would I prevent "int four = 2 + 2;" from being
executed in the following example:
try {
int division = 100/0;
int four = 2 + 2;
}
catch (DivideByZeroException de) {
Console.WriteLine("you've destroyed the world, way to go");
} ?)
kimiraikkonen - 20 Apr 2008 12:10 GMT
> A simple Google search didn't result anything (although I'm not known
> for my Google usage skills), but how would I stop the operation when an
[quoted text clipped - 11 lines]
>
> } ?)
Using try-catch, when an exception is thrown resulting as in your
catch block message, operation is stopped in "try" and catch block is
executed.
HTH,
Onur Güzel
Peter Morris - 20 Apr 2008 13:37 GMT
> (For example, how would I prevent "int four = 2 + 2;" from being executed
> in the following example:
It wont be executed. Put a breakline on your code and step through it to
see what happens.