Good afternoon, I cannot understand why I cannot make the following array:
Label[] labels = new Label[25] { label1, label2, label3, label4, ... label 25 };
Under this statement, I have a working array:
int[] array2 = new int[] { 1, 3, 5, 7, 9 };
The error that VS gives me on labels 1 through 25: the field initializer cannot refer to the non-static method or property "Class.Forms1.label1"
The following link shows us that intarray is correct, but why is my LabelArray incorrect? http://msdn.microsoft.com/en-us/library/9b9dty7d.aspx
Note. Both arrays are tested inside and outside the function.
object arrays c # visual-studio
Bart jan
source share