src/Misc/EFTools/XmlCore/Base/Util/Utils.cs
/// <summary>
///     Converts a stream to a byte array, restoring the stream's position after reading it.
/// </summary>
Converts a stream to a byte array, restoring the stream's position after reading it.
Converts a stream to a byte array restoring the stream ' s position after reading it .
private static byte[] StreamToBytes(Stream stream)
        {
            if (stream == null
                || stream.Length == 0)
            {
                return new byte[] { };
            }
            var position = stream.Position;
            stream.Position = 0;
            var bytes = new byte[(int)stream.Length];
            stream.Read(bytes, 0, bytes.Length);
            stream.Position = position;
            return bytes;
        }
private static byte [ ] StreamToBytes ( Stream stream ) { if ( stream == null || stream . Length == 0 ) { return new byte [ ] { } ; } var position = stream . Position ; stream . Position = 0 ; var bytes = new byte [ ( int ) stream . Length ] ; stream . Read ( bytes , 0 , bytes . Length ) ; stream . Position = position ; return bytes ; }
Converts a stream to a byte array, restoring the stream's position after reading it.
Converts a stream to a byte array restoring the stream ' s position after reading it .
// remember current position // set position to the start // create array, copy bytes into the array // restore position
stream
Stream