Exception Handling in C#

AramT
26.3K views

Open Source Your Knowledge, Become a Contributor

Technology knowledge has to be shared and made accessible for free. Join the movement.

Create Content
Previous: Examples

Always make sure to properly handle exceptions in your C# code, whenever you sense a code block that might generate an error, due to any reason. When handling exceptions, add the catch block beginning with the most specific exception that you think it will occur, then go less specific until most generic. Avoid catching exceptions without taking the needed actions and follow the practice of logging all your exceptions.

Article has been ported from CodingSonata.com

Open Source Your Knowledge: become a Contributor and help others learn. Create New Content