I am trying to write into a csv file row by row using C# language. Here is my function
string first = reader[0].ToString();
string second=image.
Simply use AppendAllText instead:
File.AppendAllText(filePath, csv);
The only downside of the AppendAllText is that it will throw error when file does not exist, so this must be checked
Sorry, blonde moment before reading the documentation. Anyway, the WriteAllText method overwrites anything that was previously written in the file, if the file exists.
Note that your current code is not using proper new lines, for example in Notepad you'll see it all as one long line. Change the code to this to have proper new lines:
string csv = string.Format("{0},{1}{2}", first, image, Environment.NewLine);