Foreach statement give you directly the item, you need the index only if you decide to modify the original array. But since the var holding the object always contain a reference to the instance of the object, therefore if you modify the object you do not update the array
If you tell me what you want to achieve I can give you some more suggestion. I am quite sure the code is still wrong for what your need or there are better way to do it