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?
문제
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;
}
}
}
해결책
다른 팁
Yes of course . finally
block always gets executed . Please refer this link for more details
제휴하지 않습니다 StackOverflow