Try, Throw, Catch
What do the 'try', 'throw' and 'catch' blocks accomplish within your application?
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Sanjeeb LenkaPosted Jul 25, 2013, 1:58 PM
try: A try block identifies a block of code for which particular exceptions will be activated. It's followed by one or more catch blocks.
catch: A program catches an exception with an exception handler at the place in a program where you want to handle the problem. The catch keyword indicates the catching of an exception.
finally: The finally block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.
throw: A program throws an exception when a problem shows up. This is done using a throw keyword.
for details check this link
http://www.tutorialspoint.com/csharp/csharp_exception_handling.htm
Jignesh TrivediPosted Jul 25, 2013, 10:58 PM
hi,
try ..catch block used for exceptions handling in C# and throw is used to throw exception to the main caller.
Please refer
http://msdn.microsoft.com/en-us/library/dszsf989(v=vs.80).aspx
http://www.dotnetperls.com/catch
hope this will help you.
Iftikar HussainPosted Jul 25, 2013, 10:26 PM
Please refer the below link. it is explained with example
http://msdn.microsoft.com/en-us/library/0yd65esw(v=vs.80).aspx
Regards,
Iftikar
Pankaj KumarPosted Jul 25, 2013, 1:57 PM