MetroIde.Helpers.VariousFunctions.StreamToByteArray C# (CSharp) Method

StreamToByteArray() public static method

public static StreamToByteArray ( Stream input ) : byte[]
input System.IO.Stream
return byte[]
        public static byte[] StreamToByteArray(Stream input)
        {
            var buffer = new byte[16*1024];
            using (var ms = new MemoryStream())
            {
                int read;
                while ((read = input.Read(buffer, 0, buffer.Length)) > 0)
                {
                    ms.Write(buffer, 0, read);
                }
                return ms.ToArray();
            }
        }