How do I make a 2D array of class objects public?

I seem to be encountering an odd error. I feel like I’m overlooking something but a fresh perspective would be nice.

I have a 2D array of objects of a class. However, if I try to make it public, I get the following error message:

error CS1525: Unexpected symbol ‘public’

And here is my array definition:

public MyClass[,] theArray = new MyClass[10,10];

This works perfectly fine without the “public” part, but I need it to be public so I can reference it in other functions and scripts. Any ideas?

if it says unexpected symbol ‘public’ than you are missing a semicolon on the line above this one, or just something some other thing is wrong on the upper line.