Streams Are Everywhere
Streams are a very useful abstraction that’s used far beyond just file I/O operations. As you explore the .NET Framework, you’ll find plenty of places where streams are used. Examples include the
NetworkStream class in
System.Net.Sockets, which represents the data coming from or being sent to a socket, using protocols such as TCP or UDP. Yet another place where sockets are used is in low-level data access (for example, for what’s known as file streams in SQL Server 2008 and later). Exposing them to managed code uses the concept of a
SqlFileStream, which encapsulates the communication with the server over the Tabular Data Stream (TDS) protocol.
Often, streams are also used “over” other streams. An example is compression, ...