Whenever you open a file for reading or writing it becomes a stream which is a sequence of bytes travelling from source to destination. The two commonly used streams are input and output. The included namespace is system.IO that includes many classes for file handling. The stream is an abstract class that is the parent class for the file handling process. The file is a static class with many static methods to handle file operation.
Below are the used classes :
The following table describes some commonly used classes in the System.IO namespace.
Class Name |
Description |
FileStream |
This stream read from and write to any location within a file |
BinaryReader |
read primitive data types from a binary stream |
DirectoryInfo |
perform operations on directories |
FileInfo |
perform operations on files |
BinaryWriter |
write primitive data types in binary format |
StreamReader |
to read characters from a byte Stream |
StreamWriter |
write characters to a stream. |
StringReader |
read from a string buffer |
StringWriter |
write into a string buffer |