csharp中的控制数组

问题描述:

我正在尝试制作标签数组,我该怎么做.
预先大于thanx

i m trying to make a array of labels how can i do this.
thanx in advance

Label[] labels = new Label[numLabels];
Label lbl = new Label();
labels[0] = lbl;



或使用List< Label>



or use a List<Label>

List<Label> labels = new List<Label>();
Label lbl = new Label();
labels.Add(lbl);


请尝试此操作.

Please try this.

Label[] lbl = new Label[3];
            lbl[0] = new Label();
            lbl[0].Text = "abc";
            lbl[1] = new Label();
            lbl[1].Text = "def";
            lbl[2] = new Label();
            lbl[2].Text = "pqrs";


非常有用,我一直在寻找它很久,直到看到您的帖子!非常非常有用,谢谢!
very useful I was looking for it for so long till I saw your post! very very useful thank you!