Consider the following code:
try{
....
} catch(Exception) {
return null;
throw;
}
Is there any reason?
Usually, if you put the codes after the return, Visual Studio marks this as unreachable code, but for this case it is not. Is there a reason for this?
Edit
In addition to the question, I want to ask another question.
What happens if I make an exception in the finally block after returning?
try{
....
} catch(Exception) {
return null;
} finally {
throw new Exception();
}
Ahmad source
share