What is the best practice? What is the most fast?
Is it a good practice to base your applications on exceptions and therefore throwing exceptions and handling them when appropriate rather than making a lot of if statements to check the state of objects before performing a particular algorithm?
if statements are quite heavy on the processor if I'm not mistaken while try catch blocks lock parts of the code.. am I right? Using try catch blocks and exceptions you could save some code (if statements here and there) whilst by using exceptions you would go straight to the point and if an error occurs you just handle it in a general fashion.
Any help?
Aaron
If statements VS try catch blocks
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Craig MurphyRank #2,956 · 488 reputationPosted Feb 12, 2007, 6:18 AM EST
http://www.c-sharpcorner.com/UploadFile/rajeshvs/ExceptionHandlinginCSharp11282005051444AM/ExceptionHandlinginCSharp.aspx
The advantage of using exceptions is the fact that after an exception has been raised, you still have a chance to recover/cleanup. If statements are fine for some things, however if system resources are involved, it's wise to use exceptions. There are whole chapters of books dedicated to exception handling, after you've read the article noted above, it might be worth searching for "C# exceptions" using your favourite search engine...
HTH
Ken Linder9 reputationPosted Feb 16, 2007, 8:09 AM EST
My C# web experimentation shows that exceptions can be expensive (computing resourses) and somewhat slugish when handling large amounts of data. SO, if you program is handling a lot of data, I suggest the traditional program decision control syntax/methods be used.
Ken