Sorry for troubling you with that one, it was my bad. The issue was that I
the line:
throw new Exception("exception thrown");
was written something like this:
public override int Run() {
if (i == 1) {
throw new Exception("exception thrown");
}
}
So the compiler was saying that the if statement precluded a return value
(or exception thrown) if the if condition was false.
"100" <10*@100.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi n_o_s_p_a__m,
// won't compile: "not all code paths return a value"
public override int Run() {
throw new Exception("exception thrown");
}
Compiles OK with me. No errors and no warnings.
// won't compile: "unreachable code detected"
public override int Run() {
return 1;
throw new Exception("exception thrown");
}
*Unreachable code detected* is a warning. Even though the code compiles
with warning it is incorrect. The exception won't be thrown.
// won't compile: "unreachable code detected"
public override int Run() {
throw new Exception("exception thrown");
return 1;
}
Compiles with warning.
B\rgds
100