Yes it will, but not when it is about to leave the while, but just after the code in the try or catch
is done executing.
Do this will call finally?
Pregunta
suppose that i have this code. if exception is InvalidData, do this will call finally to clean resources.
while(CanWork){
try
{
....
}
catch (InvalidDataException e)
{
LogAction(false, e.Message, e.StackTrace);
break;
}
catch (Exception e)
{
LogAction(false, e.Message, e.StackTrace);
}
finally
{
if (insta != null)
{
insta.Disconnect();
insta.Dispose();
insta = null;
}
}
}
Solución
Otros consejos
Yes of course . finally
block always gets executed . Please refer this link for more details
Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow