Reading and Writing Text Files in C#

January 24, 2009 | By | Add a Comment

With all the DBMSs out there, text files are still widely used when developing applications. They are small, fast and do not require any library or application to be installed in the client machine. The System.IO.StreamReader and System.IO.StreamWriter are used to read and write text files to disk.

The following code demonstrates reading a file selected using the OpenFileDialog control and saving to a file using the SaveFileDialog control. The code works with the .NET Framework and Mono 2.0 and later.

 

Download Source Code

 



Related Posts:

Filed in: Mono 2.0, WinForms | Tags:

Leave a Reply

Trackback URL | RSS Feed for This Entry