c# change the string in a foreach string loop

后端 未结 2 2026
终归单人心
终归单人心 2021-01-25 22:22

I\'m trying to cycle through strings in a list with a foreach loop, but I don\'t know how to change the item that\'s being referenced - How can I change s in the li

2条回答
  •  生来不讨喜
    2021-01-25 22:47

    Try this

    List listString = new List() { "1","2","3"};
    listString=listString.Select(x => x + "-").ToList();
    

提交回复
热议问题