# Writing a File: StreamWriter's Defaults

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.

![Cheat sheet: Writing a File: StreamWriter's Defaults](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/e0fefd7f9dc540c5afcf553ee0961563.webp)

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

Source: https://www.ask-codey.com/cheat-sheets/writing-to-files-in-csharp-filestream-defaults-cheat-sheet
