Other answers stating that you cannot put this line of code in a class declaration, but outside the method body, are correct. I thought it would be interesting to describe why you get the error message. The compiler is trying desperately to figure out what you mean by X[Y] = Z; , and suggests that you mean:
X[] F = Z;
That is, you accidentally placed the size of the array in an array declaration - a very common mistake among C programmers who recently learned C # and omitted the field name.
Therefore, the compiler gives the most informative error that it may encounter: you are probably a C programmer who forgot that the size of the array goes in the initializer, and not in the type declaration.
In this case, this assumption is completely false; the error here is that you accidentally put in an operator where a field declaration is expected. But most of the time this is a reasonable assumption.
source share