I get an error from the following code:
int dreamX[];
private void Form1_Load(object sender, EventArgs e)
{
sumX();
}
private void sumX()
{
for (v
What you want is this:
int[] dreamX;
private void Form1_Load(object sender, EventArgs e)
{
sumX();
}
private void sumX()
{
dreamX =( from Control control in Controls
where control.GetType() == typeof(TextBox) &&
control.Name.StartsWith("box")
select Convert.ToInt32(((TextBox)control).Text))
.ToArray();
}
The from clause produces a IEnumerable collection. You can convert this to an array with the .ToArray() extension