# Appending to a File

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.

![Cheat sheet: Appending to a File](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/cb9a452c41a44551868c4af1b4b0bab5.webp)

- Category: C#
- Level: Journeyman
- Tags: Append (c-sharp), c-sharp, StreamWriter
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/writing-to-files-in-csharp-appending-to-a-file-cheat-sheet
