C# |
So will methodA display the exception.message that methodB encountered? If not, can you explain how I would get it to?
Thanks
-Shifty
C# |
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend4days leftRegister
Jacob R36 reputationPosted Jun 16, 2010, 9:03 PM EDT
Is there any downfalls to doing it this way or is it a correct way to go about it? Reason I ask is because I would hate to have to change my project code which is around 23k lines.
Roy S194 reputationPosted Jun 19, 2010, 7:10 AM EDT
Mahesh ChandRank #1 · 393.4K reputationPosted Jun 19, 2010, 7:46 AM EDT
However, if you have some resources that are being created in MethodB, you must release them. Here is an example in pseudocode:
MethodB()
{
Create a File object
Open file
Do something with file and an exception raises.
}
You need to implement try..catch..finally block and in finally, you need to release the resources. In the above case, a File object is created and opened but not released. To release it, in Finally block, you need to release the file object.
This is not crucial for general .NET objects but it a must for IO, database connections and other system resources.
Sam HobbsRank #108 · 20.5K reputationPosted Jun 20, 2010, 1:57 AM EDT