# Reading a File in C#

Read a text file like a tiny database. Open it, go through it line by line with File.ReadLines or a StreamReader, split each CSV line into an object, and close it with using, all inside a try and catch.

![Cheat sheet: Reading a File in C#](https://fsdtrainingmedia.blob.core.windows.net/public/images/2026/11/3db00e766c6049c7993eb6d1771b9a4d.webp)

- Category: C#
- Level: Apprentice
- Tags: c-sharp, CSV File, Stream (c-sharp), StreamReader, using Statement
- Updated: November 3, 2026

Source: https://www.ask-codey.com/cheat-sheets/reading-a-file-in-csharp-cheat-sheet
