[possible?] Creating a List from ListS (X-Zibit meme, lol)

Hi, guys!

I have a number of Lists, each storing some data.

I would like to extract some of it from each List.

I decided to put every list in a List and loop through it.

I am not sure it is possible and whether it is the correct way to solve the problem.

Could you please help me? Thanks!

Here is the script:

using System.Collections;
    using System.Collections.Generic;
    using UnityEngine;
    
    public class test : MonoBehaviour
    {
     public List<int> test_container_list_1 = new List<int>();
     public List<int> test_container_list_2 = new List<int>();
     public List<int> test_container_list_3 = new List<int>();
    
    void Start()
    {
    test_container_list_1.Add(1);
    test_container_list_1.Add(11);
    test_container_list_1.Add(111);
    
    test_container_list_2.Add(2);
    test_container_list_2.Add(22);
    test_container_list_2.Add(222);
    
    test_container_list_3.Add(3);
    test_container_list_3.Add(33);
    test_container_list_3.Add(333);

    //create the List to put other lists in it.
    //Maybe use iList instead of List?
    the_ultimate_list = new List<IList>(); 
    the_ultimate_list.Add(test_container_list_1);
    the_ultimate_list.Add(test_container_list_2);
    the_ultimate_list.Add(test_container_list_3);
    //is it possible?
    
    //and then loop through it to fetch some data?
    to_remember = new GameObject;
    foreach (List looking_list in the_ultimate_list){
    if (looking_list[2] == "222")
    Debug.Log("it is");
    to_remember = looking_list[2];
    } 
    
    }
    }

I don’t remember where, but I found the answer.

In order to put a list inside a list in Unity c# the following example code may be used:

1) initiation (before Start() is called)
   public List<string> test_container_list_1 = new List<string>();
   public List<string> test_container_list_2 = new List<string>();
   public List<string> test_container_list_3 = new List<string>();
   public List<List<string>> the_ultimate_list = new List<List<string>>();

2) Start()
        test_container_list_1.Add("type: 1");
        test_container_list_2.Add("type: 2");
        test_container_list_3.Add("type: 3");

        the_ultimate_list.Add(test_container_list_1);
        the_ultimate_list.Add(test_container_list_2);
        the_ultimate_list.Add(test_container_list_3);

3) Update()
        Debug.Log(test_container_list_1[0]); //type: 1
        Debug.Log(the_ultimate_list[2][0]); //type: 3