title: Importing CSV file into a List using C#
body: <p>I am using C# to import a CSV file into my application</p>
  
  <p>Currently I had a 1 field CSV file. It worked great but now I wanted to add a 3 field CSV file into the same application.</p>
  
  <p>Once the data is stored into the List, I'm binding it to my DataGridView</p>
  
  <p>Here is the relevent code I've written. If you see any issue(s) that aren't part of my problem but can be a problem, please feel free to shout them out. Im always looking to learn and improve my code.</p>
  
  <pre><code>    BindingList&lt;StringValue&gt; data = new BindingList&lt;StringValue&gt;();
  
      private void importExcelFile()
      {
          TextFieldParser parser = new TextFieldParser(fileName);            
          parser.TextFieldType = FieldType.Delimited;
          parser.SetDelimiters(",");
          while (!parser.EndOfData)
          {
              //Processing row
              string[] fields = parser.ReadFields();
              foreach (string field in fields)
              {
                  StringValue s = new StringValue(field);
                  // Issue is here. It adds it to a single dimension array. What can I do to make it multi-dimension?
                  data.Add(s);
              }
          }
          parser.Close();
      }
  
      private void OnBackgroundWorkerDoWork(object sender, DoWorkEventArgs e)
      {            
          importExcelFile();            
      }
  
      private void OnBackgroundWorkerRunWorkerCompleted(object sender, RunWorkerCompletedEventArgs e)
      {
          dataGridView1.DataSource = data;
          dataGridView1.Columns[1].Name = "URL";
          dataGridView1.Columns[1].HeaderText = "URL";
          dataGridView1.Columns[1].Width = 300;
          dataGridView1.Columns[1].ReadOnly = true;
          dataGridView1.AutoResizeColumns();            
          toolStripStatusLabel1.Text = dataGridView1.RowCount.ToString() + " Number Of Websites";
      }
  </code></pre>
  
  <hr>
  
  <pre><code>class StringValue
  {
      string day, time, url;
      public StringValue(string s)
      {
          _value = s;
      }
  
      public StringValue(string[] s)
      {
          day = s[0];
          time = s[1];
          url = s[2];
      }
  
      public string Value { get { return _value; } set { _value = value; } }
      string _value;
  }
  </code></pre>
  
  <p>I think I should modify my StringValue class to hold the multiple fields that I'm importing from my CSV file. I'm not sure how to modify the Value part to return the data I need when I bind it to my dataGridView</p>
  
  <p>Thank you for your input and help/</p>