title: Importing CSV data into C# classes
body: <p>I know how to read and display a line of a .csv file. Now I would like to parse that file, store its contents in arrays, and use those arrays as values for some classes I created.</p>
  
  <p>I'd like to learn how though.</p>
  
  <p>Here is an example:</p>
  
  <pre><code>basketball,2011/01/28,Rockets,Blazers,98,99
  baseball,2011/08/22,Yankees,Redsox,4,3
  </code></pre>
  
  <p>As you can see, each field is separated by commas. I've created the Basketball.cs and Baseball classes which is an extension of the Sport.cs class, which has the fields:</p>
  
  <pre><code>private string sport;
  private string date;
  private string team1;
  private string team2;
  private string score;
  </code></pre>
  
  <p>I understand that this is simplistic, and that there's better ways of storing this info, i.e. creating classes for each team, making the date a DateType datatype, and more of the same but I'd like to know how to input this information into the classes. </p>
  
  <p>I'm assuming this has something to do with getters and setters... I've also read of dictionaries and collections, but I'd like to start simple by storing them all in arrays... (If that makes sense... Feel free to correct me).</p>
  
  <p>Here is what I have so far. All it does is read the csv and parrot out its contents on the Console:</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Linq;
  using System.Text;
  using System.IO;
  
  namespace Assign01
  {
      class Program
      {
          static void Main(string[] args)
          {
              string line;
              FileStream aFile = new FileStream("../../sportsResults.csv", FileMode.Open);
              StreamReader sr = new StreamReader(aFile);
  
              // read data in line by line
              while ((line = sr.ReadLine()) != null)
              {
                  Console.WriteLine(line);
                  line = sr.ReadLine();
              }
              sr.Close();
          }
      }
  }
  </code></pre>
  
  <p>Help would be much appreciated.</p>