Computer Forums

Member Login

Remember Me? Sign Up! | Forgot Password
 
Slogan
 
Closed Thread
Old 02-03-2009, 12:25 PM   #1 (permalink)
 
Junior Techie

Join Date: Nov 2008

Posts: 79

BobLewiston is on a distinguished road

Default throwing exceptions

The documentation I've found is a little hazy on this subject, so it's time to fire off yet another no-doubt ignorant question:

Is "throw" intended exclusively for the following scenario: Control is transferred out of a try block via a method call, and code in the called method then detects an exception, so the called method uses "throw" to transfer control back to the appropriate catch block associated with the original try block?
BobLewiston is offline  
Old 02-03-2009, 01:11 PM   #2 (permalink)
 
Software Developer

Join Date: Mar 2006

Location: Columbus, OH

Posts: 569

jaeusm is on a distinguished road

Default Re: throwing exceptions

The 'throw' keyword is for the programmer to specify that execution should no longer continue in the current method because of some error (null variable, non-existant file, etc.). When an exception is thrown, the CLR walks the callstack until an exception handler (catch block) is found. If one is not found, the program crashes and terminates.
jaeusm is offline  
 
Closed Thread

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sony Laptop Throwing Random BSODs SpikedCola Windows Operating Systems and Software 5 12-18-2008 04:06 PM