title: C# list<string> in a list<string>[] .toList()
body: <p>I am currently learning how to use database connections and how to read and write data. I am using Mysql data/connector 6.1 for visual studio. This supports access to a localhost mysql server. </p>
  
  <p>I want to display personal information of the person logged in for which i use this code:</p>
  
  <pre><code>string query = "SELECT * FROM gebruiker WHERE id='" + id + "'";
  
  List&lt;string&gt;[] list = new List&lt;string&gt;[5];
  list[0] = new List&lt;string&gt;();
  list[1] = new List&lt;string&gt;();
  list[2] = new List&lt;string&gt;();
  list[3] = new List&lt;string&gt;();
  list[4] = new List&lt;string&gt;();
  
  
  if (this.openConnection() == true)
  {
  
      MySqlCommand cmd = new MySqlCommand(query, connection);
      //Een nieuw datareader object maken en dan query uitvoeren
      MySqlDataReader dataReader = cmd.ExecuteReader();
  
  
      while (dataReader.Read())
      {
          list[0].Add(dataReader["id"].ToString());
          list[1].Add(dataReader["voornaam"].ToString());
          list[2].Add(dataReader["achternaam"].ToString());
          list[3].Add(dataReader["geboortedatum"].ToString());
          list[4].Add(dataReader["Rol_id"].ToString());
      }
  
      dataReader.Close();
  
      this.closeConnection();
  
      return list;
  }
  </code></pre>
  
  <p>I use Lists because I am following this tutorial: <a href="http://www.codeproject.com/Articles/43438/Connect-C-to-MySQL" rel="nofollow">tutorial</a></p>
  
  <p>Then when i return the list i want to get that data and add it to labels on my winform. this is the code i use:</p>
  
  <pre><code>DBconnect connectDB = new DBconnect();
  List&lt;string&gt;[] persGegevens = connectDB.persoonlijkeGegevens(userId);
  for (int i = 0; i &lt;= persGegevens.Count(); i++)
  {
      switch (i)
      {
          case 0:
              break;
          case 1:
              lblVoornaamVrbl.Text = persGegevens[i].ToString();
              break;
          case 2:
              lblAchternaamVrbl.Text = persGegevens[i].ToString();
              break;
          case 3:
              lblGbrtedatumVrbl.Text = persGegevens[i].ToString();
              break;
          case 4:
              lblFuntieVrbl.Text = persGegevens[i].ToString();
              break;
          default:
              break;
      }
  }
  </code></pre>
  
  <p>But unfortunatly the code does not convert the data in List toString but the element will get converted toString. This is what i get: system.collections.generic.list`1[system.string]
  I also tried to do this with a foreach but that did not work because i can't specify which element has to be placed in what label.</p>
  
  <p>Do you guys know what is the problem here? and is this the right way to retrieve data? or should i use something else to store my data?</p>