title: Writing data into CSV file in C#
body: <p>I am trying to write into a <code>csv</code> file row by row using C# language. Here is my function</p>
  
  <pre><code>string first = reader[0].ToString();
  string second=image.ToString();
  string csv = string.Format("{0},{1}\n", first, second);
  File.WriteAllText(filePath, csv);
  </code></pre>
  
  <p>The whole function runs inside a loop, and every row should be written to the <code>csv</code> file. In my case, next row overwrites the existing row and in the end, I am getting an only single record in the csv file which is the last one. How can I write all the rows in the <code>csv</code> file? </p>