Kurt
Regular
finally
Is the working of the following two pieces of code equivalent(concerning the code that's executed no matter an exception is thrown or not)? Or is there a difference other than pure syntactical dispute?
Is the working of the following two pieces of code equivalent(concerning the code that's executed no matter an exception is thrown or not)? Or is there a difference other than pure syntactical dispute?
C#:
namespace Tests
{
using System;
public class tryApp
{
private static void Main()
{
try
{
// some code that could throw an exception
}
catch
{
// handle the exception
}
finally
{
// run clean up code IN FINALLY BLOCK
}
}
}
}
C#:
namespace Tests
{
using System;
public class tryApp2
{
private static void Main()
{
try
{
// some code that could throw an exception
}
catch
{
// handle the exception
}
// run clean up code OUT OF TRY BLOCK
}
}
}