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
s
You can do this with Linq quite easily:
var newStringList = myStringList .Select(s => s + "-") .ToList();
If you really want to modify the existing list, you can use a classic for loop, for example:
for
for (var i = 0; i < myStringList.Count; i++) { myStringList[i] = myStringList[i] + "-"; }