Finally :
C# Support Another Statement Known as finally statement that can be used to handle an exception that is not caught by any of the previous catch statement , finally block can be used to handle any exception generated within a try block . It may be be added immediately after the last catch block shown as follows :
try
{
...........
...........
}
finally
{
............
............
}
another example :
try
{
...........
...........
}
catch(.........)
{
...........
..........
}
catch(.........)
{
...........
..........
}
finally
{
............
............
}
C# Support Another Statement Known as finally statement that can be used to handle an exception that is not caught by any of the previous catch statement , finally block can be used to handle any exception generated within a try block . It may be be added immediately after the last catch block shown as follows :
try
{
...........
...........
}
finally
{
............
............
}
another example :
try
{
...........
...........
}
catch(.........)
{
...........
..........
}
catch(.........)
{
...........
..........
}
finally
{
............
............
}
When a finally block is defined , this is guaranteed to execute , regardless of whether or not in exception is thrown , As a result , we can use it to perform certain house - keeping operation such as closing files and releasing system resource .