so I am interested in the c# side of it - but I am tagging c++ as the concept exists there and I am not over the 'finally' keyword. So anyway - are there any benchmarks online about how try-catch would slow down or will use more memory than simple 'if-else' or other code?? For instance, now I am writing a code and using Streamwriter which shows 7 possible exceptions when you hold your mouse over it...so would anyone claim that it will be faster if i write something like:
//////////////
if(path is not too long)
{ if(file exists)
{ if(nothing else uses the file)
{ if(user is authorized)
}}}
////////////
You have 7 conditions and you can use instead just try-catch - not to mention that these conditions cannot be simplified to a single if statement.
10x!