Skip to content

Instantly share code, notes, and snippets.

@jchandra74
Created April 14, 2015 00:03
Show Gist options
  • Save jchandra74/3a26e93ad85cd600d1fa to your computer and use it in GitHub Desktop.
Save jchandra74/3a26e93ad85cd600d1fa to your computer and use it in GitHub Desktop.
IO Extension
namespace __NAMESPACE__
{
using System.IO;
public static class StreamExtension
{
public static byte[] ToByteArray(this Stream input)
{
using (var memStream = new MemoryStream())
{
input.CopyTo(memStream);
return memStream.ToArray();
}
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment