DEV Community

Cover image for Read a Specific Line of a Text File in C#
Bradley Wells
Bradley Wells

Posted on

Read a Specific Line of a Text File in C#

Have you ever needed to get a value from a specific line number of a text document in C#? Undoubtedly, you learned there is not a native method for doing this using the StreamReader object. The class contains a ReadLine() method, but unfortunately it does not have an overloaded constructor that can accept a line number as an argument.

In this tutorial, you will write a custom method that you can invoke any time you need to read the contents of a specific line from a text file.

This is the fourth part of a series about File I/O in C#.

Read Tutorial

Top comments (0)