title: C# NullReferenceException was unhandled
body: <p>I am trying to use a CSV parser which I found on the net in my project.  The problem is I am getting a null reference exception when I try to convert the string to a Tag and my collection does not get populated. Can anyone assist? Thanks</p>
  
  <p><strong>CSV Parser</strong></p>
  
  <pre><code>private static IEnumerable&lt;string[]&gt; parseCSV(string path)
      {
          List&lt;string[]&gt; parsedData = new List&lt;string[]&gt;();
  
          try
          {
              using (StreamReader readFile = new StreamReader(path))
              {
                  string line;
                  string[] row;
  
                  while ((line = readFile.ReadLine()) != null)
                  {
                      row = line.Split(',');
                      parsedData.Add(row);
                  }
              }
          }
          catch (Exception e)
          {
              System.Windows.MessageBox.Show(e.Message);
          }
  
          return parsedData;
      }
  </code></pre>
  
  <p><strong>Tag Class</strong></p>
  
  <pre><code>  public class Tag
      {
          public Tag(string name, int weight)
          {
              Name = name;
              Weight = weight;
          }
  
          public string Name { get; set; }
          public int Weight { get; set; }
  
          public static IEnumerable&lt;Tag&gt; CreateTags(IEnumerable&lt;string&gt; words)
          {
              Dictionary&lt;string, int&gt; tags = new Dictionary&lt;string, int&gt;();
  
              foreach (string word in words)
              {
                  int count = 1;
                  if (tags.ContainsKey(word))
                  {
                      count = tags[word] + 1;
                  }
  
                  tags[word] = count;
              }
  
              return tags.Select(kvp =&gt; new Tag(kvp.Key, kvp.Value));
          }
      }
  </code></pre>