On this line
arraylist[i, i, i, j] = dt.Columns[j].ToString();
if
i
is greater than 4 it will throw the exception. That's because you have declared the array as
new string[dt.Columns.Count, 4, 4, 4];
Maybe it should be
new string[dt.Columns.Count, dt.Rows.Count, 4, 4];
? I can't tell the exact answer because I don't know what you're trying to do.
Also, by looking the name of your method (getDailyAvgRatingByCompanyId), I think this might be easier to do with a database query than with code.
Or maybe this could be done with Linq (if you're using C# 3.5 or newer)?