Click here to Skip to main content
15,885,278 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi Experts,

Is throw new Exception create another thread in C#.

e.g
C#
throw new Exception("Data not found in database");
Posted

1 solution

No.
The exception will continue on the current thread, whichever that may be.

To create a new thread, you need to explicitly create one, perhaps using the Thread or BackgroundWorker classes.
 
Share this answer
 
Comments
Er. Dinesh Sharma 10-Dec-14 9:13am    
thanks OriginalGriff :) :)
OriginalGriff 10-Dec-14 9:28am    
You're welcome!
If you think about it, it's the only thing that *can* happen: if an error occurs on the thread, it can't continue - so there is no point at all in starting a new thread! :laugh:
Imaging if you divide by zero - the thread that did the division can't do anything useful with the result.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900