Appending text to a file with Newline in C#

You can append text to a file with newline using Environment.Newline.

using System;
using System.IO;

namespace forgetCode
{
    class Program
    {
        static void Main(string[] args)
        {
            Console.WriteLine("Please enter the content to append in to the file - type exit and press enter to finish editing:");
            string newContent = Console.ReadLine();
            while (newContent != "exit")
            {
                File.AppendAllText("D:\\test.txt", newContent + Environment.NewLine);
                newContent = Console.ReadLine();
            }

        }
    }
}


Output:
The text will be written to the file with newline inserted in the mentioned path.


..