Please use code tags and point out which line in your code has the error (just the line number doesn’t necessarily tell us, because people don’t usually post the entire file).
I suspect your problem is that you have “<=” in several places where you should have “<”. Arrays in C# are numbered from 0 to (length - 1); for instance, if you have an array with 10 elements, the elements are numbered from 0 to 9. Trying to access element #10 will throw an error.