What is the prefered method for creating a byte array from an input stream?
Here is my current solution with .NET 3.5.
Stream s; byte[] b; using (
Create a helper class and reference it anywhere you wish to use it.
public static class StreamHelpers { public static byte[] ReadFully(this Stream input) { using (MemoryStream ms = new MemoryStream()) { input.CopyTo(ms); return ms.ToArray(); } } }