using System.IO; string filePath = @"C:\example.txt"; //path to text file string myLine = "This is a new line!"; //new line to be added //open file in append mode using (StreamWriter sw = File.AppendText(filePath)) { //add new line to file sw.WriteLine(myLine); }In this example, we first specify the path to the text file we want to add the new line to. We then create a string containing the new line we want to add. Next, we use the StreamWriter class to open the file in "append" mode. This means that any new content we write to the file will be added to the end of the existing content. Finally, we use the sw.WriteLine() method to add our new line to the file. The AddLine method is part of the System.IO namespace in C#.