public static byte[] ReadStream(Stream s) { var buffer = new byte[2048]; using (var output = FastArray.New(2024)) do { var i = s.Read(buffer, 0, buffer.Length); if (i == 0) { return(output.ToArray()); } output.AddRange(buffer, i); } while (true); }