我有一个项目,我必须采取的输入names,weights以及heights并付诸阵列,并显示它们放入一个TextBox像这样的
name = "..."
weight = "..."
height= "..."
Run Code Online (Sandbox Code Playgroud)
我已经能够填充我的数组,但我不明白如何输出它像上面的例子.目前我的输出是所有名称,然后所有权重然后所有高度.有人可以解释我怎么能让它像示例一样显示?我到目前为止的代码是
private void ShowButton_Click(object sender, EventArgs e)
{
txtShow.Text += string.Join(System.Environment.NewLine, nameArray);
txtShow.Text += string.Join(System.Environment.NewLine, weightArray);
txtShow.Text += string.Join(System.Environment.NewLine, heightArray);
}
private void AddButton_Click(object sender, EventArgs e)
{
if (this.index < 10)
{
nameArray[this.index] = nameBox.Text;
weightArray[this.index] = double.Parse(weightBox.Text);
heightArray[this.index] = double.Parse(heightBox.Text);
this.index++;
}
}
Run Code Online (Sandbox Code Playgroud)
该阵列最多可以存储10个值,我需要使用数组而不是列表.