Tag Archives: stream

DecoratorStream

In scenarios where you want to extend functionality of a simple System.IO.Stream instance, it is convenient to have a decorator. Neither the original stream or the client instance will have to know anything about the extension as it is still just a Stream. This can be used to add position tracking or to manage lifetime. […]

Stream.CopyTo

Here’s a small snippet I use a lot when working with streams. It simply copies content from one stream to the other in chunks of 4 KB. It is so handy that the BCL team added it to the stream class in .NET 4.0. static long CopyTo(this Stream input, Stream output) { if (!input.CanRead || […]

Follow

Get every new post delivered to your Inbox.