You must use the Select function if you want a different result.
var items = listBox1.Items.Cast<string>().ToList(); listBox1.Items = items.Select(item => (!chkBox1.Checked) ? "move " + item : "move -check " + item).ToList();
The ForEach function can do something according to the value of the collection, but it cannot do it with the values themselves.
The Select function will create a new collection in accordance with this collection.
Edit
About your change of successful value changes with
tapes.ForEach(x => x.vItem = "tapelib 3592 -eject " + x.vItem);
You need to understand how the passing argument by value / reference works.
In C #, when writing var obj1 = new object() , obj1 is a pointer to new object() that exists on the heap .
When you pass obj1 to the public void Foo(object obj) { //... } function public void Foo(object obj) { //... } by calling Foo(obj1) , the function will receive the parameter as a new pointer to the same object on the heap.
Therefore, when you use ForeEach on the object itself,
object.ForEach(obj => obj = new object())
only the new pointer will be changed and it will point to the new object, but the original pointer will not be changed.
But if you use it on an internal object,
object.ForEach(obj => obj.InnerObject = new object())
this will change the pointed inner object and the inner object will be resized.