You may create your controls programmatically and make an array:
var combos = Enumerable.Range(0,100)
.Select((x, i) => new ComboBox {Name = $"TypeComboBox{i}", Visible = false, ...})
.ToArray();
or you may just get controls by name:
ComboBox GetCombo(int index)
{
var name = "TypeComboBox" + index.ToString().PadLeft('0',2);
var combo = this.Controls[name];
return combo;
}
it is also possible to assign your existing controls to an array:
var combos = parent.Controls.OfType<ComboBox>()
.OrderBy(c => c.Name)
.ToArray(); //parent can be your form or whatever
//control that contains your comboboxes
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…