title: Read file using FileDialog and save to the List<>
body: <p>I am trying to read text file and store the information into the List&lt;>.</p>
  
  <p>So far, I managed to read strings off the file and split it, but having trouble storing the information onto the List&lt;>. Perhaps I am trying to do too many things under one function. </p>
  
  <pre><code>using System.IO;
  
  private void openFileDialog_Click(object sender, EventArgs e)
          {
              if (myOpenFileDialog.ShowDialog() == DialogResult.OK) ;
              using (FileStream fStream = File.OpenRead(myOpenFileDialog.FileName))
              {
  
                  StreamReader reader;
                  reader = new StreamReader(fStream);
                  string line;
  
                  while ((line = reader.ReadLine()) != null)
                  {
                      string[] playerInfo = line.Split(';');
                      int ID = int.Parse(playerInfo[0]);
                      string firstName = playerInfo[1];
                      string lastName = playerInfo[2];
                      DateTime dob = DateTime.Parse(playerInfo[3]);
                      List&lt;Player&gt; players = new List&lt;Player&gt;
                      players.add(new Player(id, firstName, lastName, dob);
                  }
  
              }
          }
  </code></pre>
  
  <p>When I check with MessageBox.Show, it comes out with 0 for the amount of lines I have in the file...
  Perhaps my list.add code is in wrong place.
  Thank you for your help and your time</p>