A try/catch scope may also define an optional finally block. The motivation behind a finally
U N D E R S TA N D I N G S T R U C T U R E D E X C E P T I O N H A N D L I N G
To illustrate, assume you wish to always power down the car’s radio before exiting Main(), regardless
of any handled exception:
static void Main(string[] args)
{
Console.WriteLine("***** Handling Multiple Exceptions *****\n");
Car myCar = new Car("Rusty", 90);
myCar.CrankTunes(true);
try
{
Do'stlaringiz bilan baham: