Programming C# 2.0, 3.0, 4.0: Muhammed Ali Sakhi Microsoft Certified Trainer
Programming C# 2.0, 3.0, 4.0: Muhammed Ali Sakhi Microsoft Certified Trainer
© PakDev.net
Agenda
Catching Exceptions
State of an Exception
Throwing Exceptions
Finally block
© PakDev.net
Catching Exceptions
Use try catch block
In the catch block provide the exception type
you want to catch
© PakDev.net
Throwing Exceptions
Use the throw keyword
Throw the instance of any Exception type class
Provide the custom message
© PakDev.net
Processing Multiple Exceptions
A try catch block can trigger multiple exceptions
© PakDev.net
The finally block
It is an optional block
© PakDev.net
Exception Handling
Demo
© PakDev.net
Thank you
PakDev.net
© PakDev.net