Those who prefer reading this site through RSS now can also subscribe for updates to .NET Tips & Tricks Community.
Do not rely on exceptions in your code and write code that avoids exceptions. Since exceptions cause performance to suffer significantly, you should never use them as a way to control normal program flow. If it is possible to detect in code a condition that would cause an exception, do so. Do not catch the exception itself before you handle that condition. Do not use exceptions to control logic. A database connection that fails to open is an exception but a user who mistypes his password is simply a condition that needs to be handled. Common scenarios include checking for null, assigning a value to a String that will be parsed into a numeric value, or checking for specific values before applying math operations.
//Unnecessary use of exception
try
{
value = 100/number;
}
catch(Exception ex)
value = 0;