I've got a 2 dimensional string array that I'm trying to serialize into a memorystream, and then read the memorystream using a binaryreader to get a bytearray.
The problem is that my byte array always ends up with nothing but 0's in it.
If I however, serialize to a filestream, it works alright.
Is there something obvious I've missed in my code?
(TileInfo is the 2-dimensional string array)
VB Code:
Dim formatter As Runtime.Serialization.IFormatter = New Runtime.Serialization.Formatters.Binary.BinaryFormatter Dim memStream As New IO.MemoryStream formatter.Serialize(memStream, TileInfo) Using bReader As New IO.BinaryReader(memStream) Dim byteArray(CInt(bReader.BaseStream.Length)) As Byte bReader.Read(byteArray, 0, CInt(bReader.BaseStream.Length)) BytesToSend.AddRange(byteArray) End Using memStream.Close()
Thanks.




Reply With Quote