The specific errors happens because there is a bug in the following line
Quote:
for (int i = 0; i <= array.Length; i++)
It should be
for (int i = 0; i < array.Length; i++)
In any case, your implementation of the merge sort algorithm doesn't look correct.