C#里面怎么定义,怎么使用全局数组?
代码如下,我使用了静态的类,MyLabel.MyLabelBelt是我自定义的控件,继承自label
namespace CarouselManager{ public static class testlabel { public static MyLabel.MyLabelBelt[] LabelBelt = new MyLabel.MyLabelBelt[1000]; } public partial class View_Belt_Dyna { public View_Belt_Dyna() { InitializeComponent(); for (int i = 0; i < 1000; i++) { testlabel.LabelBelt[i] = new MyLabel.MyLabelBelt(); } } private void simpleButton_Init_Click(object sender, EventArgs e) { for (int ii = 0; ii < 1000; ii++) { if (testlabel.LabelBelt[ii].Area.Trim() == "仓库1号") { ......... } } } }}