【发布时间】:2017-12-22 14:08:31
【问题描述】:
每次单击按钮时,我都会得到“5”的结果。我想遍历一个数组并显示resultLabel 中的所有元素。
protected void okButton_Click(object sender, EventArgs e)
{
int[] myArray = new int[5] { 1, 2, 3, 4, 5 };
for (int i = 0; i < myArray.Length; i++)
{
resultLabel.Text = String.Join(" ", myArray[i].ToString());
}
}
【问题讨论】: