C# File Handling

C# File Handling System.IO namespace contains all the type information for reading and writing data streams and files. The FileStream constructor which takes the path of a file and mode of opening the file is a convenient way of associating a file with a stream. The StreamReader class is initiated with the constructor of StreamReader. The StreamReader constructor is available in various forms. In one of the forms the StreamReader constructor can take the specified stream with an encoding type as arguments. The StreamReader class reads line of information from the file. The ReadLine method is used for this purpose. The Close method releases the resources associated with the StreamReader.


1st line of code.
2nd line of code.
3rd line of code.