The code example below gives "Using the unrecognized local variable" resultCode "when compiling:
string answer;
string resultCode;
try
{
resultCode = "a";
}
catch
{
resultCode = "b";
}
finally
{
answer = resultCode;
}
I would think that the above catch block should catch all exceptions, and therefore it is impossible that resultCode was not assigned at the time the finally block is entered. Can anyone shed some light? Thank.
EDIT: Thanks to everyone. This answer, which cites the documentation, seems to be responding well to it: https://stackoverflow.com/a/166778/
source
share