We looked briefly at accessing data streams in the last chapter when we talked about the request stream property of the WebRequest class. I glossed over that subject then, but now we should really understand how our data is prepared for transmission as a request payload. We'll look at the common interface for data streams in C#, and give special consideration for some of the trickier or less obvious aspects of streams that can introduce some difficult-to-find bugs into your code. So, let's start with the Stream class and go from there.
Going with the flow – data streams in C#
Initializing a data stream
Just like with network requests, writing to and reading from data streams is a common and straightforward...