# Writing to Files in C#

Writing to Files in C#: Writing a File: StreamWriter's Defaults, Appending to a File.

Updated: November 3, 2026

1. [Writing a File: StreamWriter's Defaults](https://www.ask-codey.com/lessons/writing-to-files-in-csharp-filestream-defaults) (Journeyman): A StreamWriter writes text to a file the way Console writes to the screen. By default it creates the file, or replaces one that's already there. Close it with using, so everything written reaches the disk.
2. [Appending to a File](https://www.ask-codey.com/lessons/writing-to-files-in-csharp-appending-to-a-file) (Journeyman): To add to the end of a file instead of replacing it, open a StreamWriter with append set to true, or use File.AppendAllText. Either creates the file if it isn't there yet.

Source: https://www.ask-codey.com/courses/csharp-full-stack-bootcamp/topics/writing-to-files-in-csharp
