Re-instantiated prefabs desist changes in text component

I’ve created an UI scroll list and after performing certain operations, the list is populated with multiple instances of a prefab containing UI text as one of its components. An operation changes the text within the text component of the prefab. This is performed without any anomalies for the first operation, but subsequent operations fail to change the text as desired. I’m storing the text to be replaced with inside a List of strings. Following is the code:

public List<string> collectionlist = new List<string>{};
    /*some code to insert relevant data into the list through a loop*/
    //loop for instantiating prefabs into the scroll list (which has the component Vertical Layout 
    //Group script attached to it).
    for(int i=0;i<=collectionlist.Count-1;i++)
        Content.transform.GetChild(i).GetChild(0).GetComponent<Text>().text=collectionlist *;*


The list items are to be erased and created repeatedly owing to certain operations. So before proceeding to list the results of of the next operation, I destroy the already instantiated list items by using the following code:


  • foreach (Transform child in Content.transform)*
    And proceed to re-instantiate and populate the list with prefabs and to change the text accordingly, but the second or random intermediate operations fail to change the text as desired by the operation and the default prefab text is displayed. I wonder what am I doing wrong?

This helped here:

using System.Linq;
     // [ ... ]
     foreach (Transform child in Content.transform.Cast<Transform>().ToArray())

Here’s the clarification: