C# CSVWriter how to avoid getting empty line at the end of writing all lines to a file
<p>I am using CSVWriter to write to csv by using the following link:</p>

<p><a href="https://stackoverflow.com/questions/38271169/how-to-create-csv-with-header-and-footer-using-linqtocsv-or-anything-better-in-c/38274284#38274284">How to create csv with header and footer using LinqtoCsv or anything better in C#</a></p>

<p>But for some reason i am getting an empty line created at the end. Can anyone help me what am i doing wrong or how can i avoid getting an empty line?</p>

<p>Here is the code to create csv using csvwriter:</p>

<pre><code>        using (var writer = File.AppendText(outputCsv))
        {
            var csv = new CsvWriter(writer);
            csv.Configuration.RegisterClassMap&lt;CustomMap&gt;();
            csv.Configuration.HasHeaderRecord = true;
            csv.Configuration.QuoteNoFields = true;
            csv.Configuration.Delimiter = "|";

            csv.WriteRecords(asRunLogs.ToList());
            csv.WriteRecord(new CSVFooterRecord()
            {
                FooterText =
                    $"TRAILER:{"qsaam_promos.csv"}|{DateTime.Now.ToString("ddMMyyHHmm")}|{asRunLogs.Count}"
            });
        }
</code></pre>

<p>When i open the file in Notepad++, i can see an empty line at the end.</p>

<p>Appreciate help with regard to this.</p>

<p>Thanks</p>