Skip to content

Instantly share code, notes, and snippets.

@jchandra74
Created April 14, 2015 00:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • 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