Oct 19, 2009

Index was outside the bounds of the array

This blog post is intended for beginners in .NET programming



I'm sure you will come across this error once or more. This usually happens when you try to refer an array element that doesn't exist. As for example in the screenshot above, I have a array initialized with just two elements and trying to access the fifth element that isn't there, hence the error!
Also note it'll be runtime and you won't catch it while compiling.
Happy Coding!

No comments:

Post a Comment