title: C# How to iterate throught all the lists in child's list?
body: <p>so I've stopped to this problem which solution I can't think of, it currently escapes my mind althought I think I did this same thing on another project, but I lost the files..</p>
  
  <p>Thing is, I'm writting a dialogue system that has one answer line, and up to 3 question lines, each of these question lines, when clicked, have another answer line and can have even more questions to be made.</p>
  
  <p>The goal is to be able to make a dialogue system that can have as much answers and questions in line as you want.</p>
  
  <p>But I don't know how to iterate them all, if it was a fixed number, I could make a for loop for each number of questions, but it not being the case, I'm stuck on it!</p>
  
  <p>The following code is an example of a fixed number of ONE question and its answer and another list of questions:</p>
  
  <pre><code>for(int i = 0; i &lt; dialogGiver.dialogLines.Count; i++)
  {
      EditorGUILayout.LabelField("Line " + i, EditorStyles.boldLabel);
  
      dialogGiver.dialogLines[i].line = EditorGUILayout.TextField("Question", dialogGiver.dialogLines[i].line);
      dialogGiver.dialogLines[i].answer = EditorGUILayout.TextField("Answer", dialogGiver.dialogLines[i].answer);
  
      for (int e = 0; e &lt; dialogGiver.dialogLines[i].dialogLines.Count; e++)
      {
          EditorGUILayout.LabelField("Line " + i + "/ Line " + e, EditorStyles.boldLabel);
      }
  }
  </code></pre>
  
  <p>So thing is, how do I make that loop look for as much sub-questions and sub-lines as the DialogLine (and the DialogLine childs into that DialogLine) has.</p>
  
  <p>This is the DialogLine class:</p>
  
  <pre><code>public class DialogLine
  {
      public string line;
      public string answer;
  
      /// &lt;summary&gt;
      /// This will enable the dialog giver to continue speaking of the same theme (use for long dialogs!)
      /// &lt;/summary&gt;
      public List&lt;DialogLine&gt; dialogLines = new List&lt;DialogLine&gt;();
  }
  </code></pre>
  
  <p>Thanks in advance, I'm willing to learn how should this work!</p>