This is the third part in a series about C# file i/o operations. In this tutorial, you will learn how to use the StreamReader object in C# to read the contents of an existing file. This could be useful, for example, for reading a settings file or for restoring default settings from a file, particularly when a database is unnecessary.
You will learn how to use the ReadToEnd() method, the ReadLine() method, and the Read() method. The tutorial also details how to ensure your StreamReader object is properly disposed, even if an error occurs. Finally, the tutorial covers the basics of handling C# file i/o errors.
Click through to the source for the full tutorial: Source
Top comments (0)