core/src/Extensions/MiscExtensions.cs
/// <summary>
/// Read a stream into a byte array
/// </summary>
/// <param name="input">Stream to read</param>
/// <returns>byte[]</returns>
Read a stream into a byte array
Read a stream into a byte array
public static byte[] ReadAsBytes(this Stream input)
        {
            byte[] buffer = new byte[16 * 1024];
            using (MemoryStream ms = new MemoryStream())
            {
                int read;
                while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                return ms.ToArray();
            }
        }
public static byte [ ] ReadAsBytes ( this Stream input ) { byte [ ] buffer = new byte [ 16 * 1024 ] ; using ( MemoryStream ms = new MemoryStream ( ) ) { int read ; while ( ( read = input . Read ( buffer , 0 , buffer . Length ) ) > 0 ) { ms . Write ( buffer , 0 , read ) ; } return ms . ToArray ( ) ; } }
Read a stream into a byte array
Read a stream into a byte array
None
Stream
this
input
Stream to read
Stream to read