如何将字符串打印到数组

-1 c# arrays

当单击"打印"按钮时,我需要将这些名称打印到输出标签上.现在当我点击按钮打印名称时,会弹出3行,说明System.String[].如何打印这些名称而不是System.String[]消息?谢谢!

string[] names = new string[] {"Kevin", "Anthony", "Mike", "Allan" };
private void button1_Click(object sender, EventArgs e)
{
    //taverse the array and dispalay the scores into the label
    string output = "";
    for(int i=0;i<=names.Length; i++)
    {
        output = output + names + "\n";
    }
    displayLabel.Text = output;
}
Run Code Online (Sandbox Code Playgroud)

A.T*_*.T. 5

你忘了添加索引.

for (int i = 0; i < names.Length; i++){
    output = output + names[i] + "\n";
}
Run Code Online (Sandbox Code Playgroud)