title: How to read a txt file and load the contents into an arraylist?
body: <p>I am new to C# and to programming in general. I am trying to read the contents of a txt file and load them to an <code>arraylist</code>. I can't figure out what condition to use in my <code>while</code> loop.</p>
  
  <pre><code>void LoadArrayList()
  {
      TextReader tr;
      tr = File.OpenText("C:\\Users\\Maattt\\Documents\\Visual Studio 2010\\Projects\\actor\\actors.txt");
  
      string Actor;
      while (ActorArrayList != null)
      {
          Actor = tr.ReadLine();
          if (Actor == null)
          {
              break;
          }
          ActorArrayList.Add(Actor);
      }  
  }
  </code></pre>