MemoryStream: ToArray

ToArray

Writes the stream contents to a byte array, regardless of the Position property.



 Public Function ToArray ( ) As Byte ( )

Return Values

Byte() -  A new byte array.

Remarks

This method omits unused bytes in MemoryStream from the array.

This method returns a copy of the contents of the MemoryStream as a byte array. If the current instance was constructed on a provided byte array, a copy of the section of the array to which this instance has access is returned. See the MemoryStream constructor NewMemoryStream for details.
Note
The method works when the MemoryStream is closed.

See Also

Project CorLib Overview

Class MemoryStream Overview