using System.IO; TextWriter writer = new StreamWriter("output.txt"); writer.Append("Hello, World!");
using System.IO; TextWriter writer = new StreamWriter("output.txt"); writer.Append("Hello, World!"); writer.Append(Environment.NewLine); writer.Append("Welcome to C# programming.");Package/Library: System.IO Note: The TextWriter class provides other useful methods to write to the stream such as Write, WriteLine, and Flush. These methods can be used to write various types of data to the stream, including integers, doubles, and objects.