Stuck on .NET 2.0 – 3.5? Copy streams easily with this NuGet extension!

If you’re still stuck on .NET 2.0, 3.0, or 3.5 for any reason and don’t have access to the .CopyTo method for System.IO.Stream objects, the Stream.CopyTo extension method, available as a small NuGet package will make manually allocating buffers and other boilerplate associated with copying a buffer from one stream to another a thing of the past.

Stream.CopyTo is as simple as a NuGet package could be, but it let’s you use .NET 4.0’s Stream.CopyTo method on earlier versions of the framework. It too resides in the System.IO namespace and provides the same functions (and overrides) as the official .NET 4.0+ version of its namesake, meaning it’s a drop-in replacement perfect for publishing multi-targeted code, etc. that “just works” on all versions of the .NET Framework.

As with all our other NuGet publications, Stream.CopyTo is fully open-source and published on GitHub under the terms of the MIT license. To make life easier, it’s also available on NuGet, making it a single Visual Studio package manager (console) install away.

Download: Stream.CopyTo

  • Similar Posts

    Craving more? Here are some posts a vector similarity search turns up as being relevant or similar from our catalog you might also enjoy.
    1. Compare streams quickly and efficiently in C# and .NET
  • One thought on “Stuck on .NET 2.0 – 3.5? Copy streams easily with this NuGet extension!

    1. .Net is really a dead end. I build native win32 applications with Delphi and I am never limited because Delphi applications do not depend on a framework to run.

    Leave a Reply

    Your email address will not be published. Required fields are marked *