title: c# write an arraylist to a text file
body: <p>I need to write my array list into a text file and so far have come up with this code.
  Now im confused as to how to write the 'line' to my text file using the textwriter?
  One procedure loads the list out of a txt file below.</p>
  
  <pre><code>public void LoadArrayList()
  {
  TextReader tr;
  tr = File.OpenText("C:\\Users\\Mirro\\Documents\\Visual Studio 2010\\Projects\\Assessment2\\Assessment2\\act\\actors.txt");
  string line = tr.ReadToEnd();
  Console.WriteLine(line);
  if (line != null)
  {
      ActorArrayList.Add(line);
  }
  else
  
   tr.Close();
  }
  </code></pre>
  
  <p>Then i have one that will populate the combo box in my form.</p>
  
  <pre><code>public void PopulateActors()
  {
    cboActor.Items.Clear();
    foreach (string line in ActorArrayList)
          {
              cboActor.Items.AddRange(File.ReadAllLines("C:\\Users\\Mirro\\Documents\\Visual Studio 2010\\Projects\\Assessment2\\Assessment2\\act\\actors.txt")); 
          }
  }
  </code></pre>
  
  <p>and this procedure i need it to write my whole array "ActoryArrayList" into the text file.</p>
  
  <pre><code>public void WriteArrayList()
  {
  
  }
  </code></pre>
  
  <p>Im sorry for being confusing originally.</p>