Sunday, March 21, 2010

Try-Catch or Check Length? C# XNA

Programmer Question

I was just wondering which would be cheaper, using a try catch block for index out of bounds or checking the length of a multi dimensional array and comparing values?



I have a feeling it's the length, since I can store the length in a variable and then just do if's which are relatively cheap. I'm just not sure how expensive try-catch is.



Thanks!



Find the answer here

No comments:

Post a Comment

LinkWithin

Related Posts with Thumbnails