Using Memory Streams
Memory streams are special objects that act like file streams but that work in memory, providing the ability to manipulate binary data. The following code creates a MemoryStream
with 2 Kbytes capacity and puts in a string:
To retrieve data you use a BinaryReader
pointing to the MemoryStream
as you saw in the paragraph for binary files. So, in this example, you can simply invoke ReadString
as follows:
Get Visual Basic® 2010 Unleashed now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.