Skip to content

Instantly share code, notes, and snippets.

@sailfish009
Created October 26, 2018 02:30
Show Gist options
  • Select an option

  • Save sailfish009/71cdfbb667ffa7b3f47aa5f58b1948eb to your computer and use it in GitHub Desktop.

Select an option

Save sailfish009/71cdfbb667ffa7b3f47aa5f58b1948eb to your computer and use it in GitHub Desktop.
https://stackoverflow.com/questions/8613187/an-elegant-way-to-consume-all-bytes-of-a-binaryreader
public byte[] ReadAllBytes(Stream stream)
{
using (var ms = new MemoryStream())
{
stream.CopyTo(ms);
return ms.ToArray();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment