The Stream Model in .NET: Short Reads, Decorator Chains and leaveOpen
Stream.Read returns the bytes available right now, not the count you asked for, so fixed-size data needs ReadExactly. We write and read Bookstore's order export through a FileStream, GZipStream and CryptoStream chain and show dispose order, leaveOpen, copying with ArrayPool and writing your own Stream, all with real output.
14 Nov 2026
·
14 min
·
2