Display List in textBox (Winforms)

前端 未结 5 1780
情歌与酒
情歌与酒 2020-12-13 21:02

Noob question... I\'m trying to display a List in a textbox... unfortunately, my code only displays the first element in the list...

    private void Form1_L         


        
5条回答
  •  一向
    一向 (楼主)
    2020-12-13 21:09

    Try this:

    public string displayMembers(List vegetables)
    {
        var text = string.Empty;
        foreach (String s in vegetables)
        {
            text += s.ToString() + "\r\n";
        }
        return text;
    }
    

提交回复
热议问题