On Wed, 18 Jan 2006 16:48:13 -0500, "A.M-SG"
<al******@newsgroup.nospam> wrote:
Hi,
I underestand that we can use try finally without catch clause. Something
like this:
try
{
throw new Exception("Test")
}
finally
{
// close all files
}
What exactly is this?
Thank you,
Alan
I am not quite sure what you are asking. THe finally clause
guarantees that the code inside it will be executed, no matter how the
try block terminates. This includes if the try block throws an
exception.
Try:
try {
Console.WriteLine("Alpha");
throw new Exception("Test");
Console.WriteLine("Beta");
}
finally {
Console.WriteLine("Gamma");
}
and see which bits show on screen.
rossum
--
The ultimate truth is that there is no ultimate truth