I want to update the content of my csv, but I want to do it an other way than delete the whole content and write it again. Is there a way to rewrite a specific line in the csv file? I am doing something like this at the moment:
System.IO.File.WriteAllText("File.csv", string.Empty);
using (StreamWriter sw = File.AppendText("File.csv"))
{
var writer = new CsvWriter(sw);
for (int i = 0; i < Values.Count; i++)
{
writer.WriteField(Values[i]);
writer.NextRecord();
}
}
I use CsvHelper. Something like :