.NET Tutorials, Forums, Interview Questions And Answers
Welcome :Guest
 
Sign In
Register
 
Win Surprise Gifts!!!
Congratulations!!!


Top 5 Contributors of the Month
david stephan

Home >> Forum >> C# >> Post New QuestionBookmark and Share Subscribe to Forum

exception handling in c#.net?

Posted By: naresh reddy     Posted Date: March 05, 2010    Points:2   Category :C#
give brief and easy introduction about exception handling in c#.net?

Responses
Author: Syed Shakeer Hussain             
Posted Date: March 05, 2010     Points: 5   

Hi Naresh,
check the below link,you will learn very easily with good examples

http://www.devarticles.com/c/a/C-Sharp/Exception-Handling-in-C-sharp/

Author: Kunal Chowdhury             
Posted Date: March 05, 2010     Points: 5   

Naresh,

Some of the tips I will add here is:

- Catch only the exceptions which you can handle
- Catch the exact exception rather than catching the generic exception
- Catch exception one by one in priority order & if you think there might be any other exception then only use the generic block
- Never put unnecessary Try{} Catch{} block, it requires more processing power
- If you are creating some resource, use Finally{} block to release all the resources

Author: abhay             
Posted Date: March 08, 2010     Points: 5   

try
{
///your code

}
catch(Exception ex)
{
//
}

//you can add finally block here



Post Reply

You must Sign In To post reply
 
 
Find more Forum Questions on C#, ASP.Net, Vb.Net, SQL Server and more Here
Quick Links For Forum Categories:
ASP.NetWindows Application  .NET Framework  C#  VB.Net  ADO.Net  
Sql Server  SharePoint  OOPs  SilverlightIISJQuery
JavaScript/VBScriptBiztalkWPFPatten/PracticesWCFOthers
www.DotNetSpark.comUnAnsweredAll

Hall of Fame    Twitter   Terms of Service    Privacy Policy    Contact Us    Archives   Tell A Friend