I have this azure function app that process errors. Before my app exits, I would like to write the errors in our memory as csv and then send the file to a client in an email.This is the code I have that stores file in the disk.
using (var writer = new StreamWriter(fileName))
using (var csv = new CsvWriter(writer, CultureInfo.InvariantCulture))
{
foreach (var row in content)
{
foreach (var col in row)
{
csv.WriteField(col);
}
csv.NextRecord();
}
}