0% found this document useful (0 votes)
23 views8 pages

Programming C# 2.0, 3.0, 4.0: Muhammed Ali Sakhi Microsoft Certified Trainer

Uploaded by

alisakhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
23 views8 pages

Programming C# 2.0, 3.0, 4.0: Muhammed Ali Sakhi Microsoft Certified Trainer

Uploaded by

alisakhi
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 8

Programming C# 2.0, 3.0, 4.

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

TargetSite: provides various details about the


method
StatckTrace: Identifies the series of calls
HelpLink: Can be use to point the user to a
specific URL

© 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

Use multiple catch blocks

Start with most specific exception to most


generic one

© PakDev.net
The finally block
It is an optional block

It will always execute


After try block, or
After catch block

© PakDev.net
Exception Handling

Demo

© PakDev.net
Thank you
PakDev.net

© PakDev.net

You might also like