The main operations with files are related to reading, writing, retrieving, and updating text present in file. In .NET, these operations are performed using an exchange of bytes in I/O operations. This sequence of bytes is a stream, and in .NET, it's represented using the abstract Stream class. This class forms the basis of all I/O operations in .NET such as FileStream and MemoryStream.
With stream we can perform the following operations in .NET:
- Reading data in the stream object
- Writing data into the stream object
- Searching for or finding relevant information from the stream object
Let's take a look at the different operations that are implemented using stream objects. In the next section, we will go through the FileStream object, which aids operations on the file object.