title: Issues append data to a .csv File using C#
body: <p>I am manipulating a csv file using C# but I have an issue. When I added a new row, the first iteration does successful, but the second one overwrite the same row previous.</p>
  
  <p>Example CSV File:</p>
  
  <p>Name, LastName, Age</p>
  
  <p>David, Todd, 28</p>
  
  <p>Juan, Perez, 30</p>
  
  <hr>
  
  <p>First iteration:</p>
  
  <p>Name, LastName, Age</p>
  
  <p>David, Todd, 28</p>
  
  <p>Juan, Perez, 30</p>
  
  <p>Pepe, Hernandez, 32</p>
  
  <hr>
  
  <p>Second iteration:</p>
  
  <p>Name, LastName, Age</p>
  
  <p>David, Todd, 28</p>
  
  <p>Juan, Perez, 30</p>
  
  <p>Pepe, Hernandez, 32Maria,Lopez,35</p>
  
  <hr>
  
  <p>What am I doing wrong?</p>
  
  <p>This is my code:</p>
  
  <pre><code>string newFileName = "C:\\names.csv";
  string nameDetails = txtName.Text + "," + txtLastName.Text + "," + txtAge.Text;
  if (!File.Exists(newFileName))
  {
  
      string nameHeader = "Name" + "," + 
      "LastName" + "," + "Age" + Environment.NewLine;
  
      File.WriteAllText(newFileName, nameHeader);
  
  }    
  
  File.AppendAllText(newFileName, nameDetails);
  </code></pre>
  
  <p>Thanks!</p>