G
Guest
I have a class containing string variables, hashtables..I managed to
serialize it into a memory stream instead of file stream. Would like to know
how can I convert the byte array to string. I tried using
encoding.default.getstring but the output is an empty string....damn!
partial code example that copied for microsoft for testing purpose:
Dim addresses As New Hashtable
addresses.Add("Jeff", "123 Main Street, Redmond, WA 98052")
addresses.Add("Fred", "987 Pine Road, Phila., PA 19116")
addresses.Add("Mary", "PO Box 112233, Palo Alto, CA 94301")
Dim mstrm As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(mstrm, addresses)
dim str as string = encoding.default.getstring(mstrm.toarray)
Please advise.
serialize it into a memory stream instead of file stream. Would like to know
how can I convert the byte array to string. I tried using
encoding.default.getstring but the output is an empty string....damn!
partial code example that copied for microsoft for testing purpose:
Dim addresses As New Hashtable
addresses.Add("Jeff", "123 Main Street, Redmond, WA 98052")
addresses.Add("Fred", "987 Pine Road, Phila., PA 19116")
addresses.Add("Mary", "PO Box 112233, Palo Alto, CA 94301")
Dim mstrm As New MemoryStream
Dim formatter As New BinaryFormatter
formatter.Serialize(mstrm, addresses)
dim str as string = encoding.default.getstring(mstrm.toarray)
Please advise.