Easily Serializing an Object

  • Thread starter Thread starter Scott Meddows
  • Start date Start date
S

Scott Meddows

I'm trying to serialize an object in VB.NET. I have all my objects denoted
with the <Seralizable()> Attribute. This is the code I am using...

Dim sf As SoapFormatter = New SoapFormatter

Dim ms As IO.MemoryStream = New IO.MemoryStream

sf.Serialize(ms, currentIssue)

ErrorReportingTextBox.Text &= vbCrLf &
Convert.ToString(Convert.ToBase64String(ms.ToArray).ToString)



I get a list of a whole bunch of strange letters. So, I know I'm doing this
wrong, but I just want a simple serialization. I'd prefer to not have any
SOAP envelopes and such in the data (This is the only sample I could find)
 
I get a list of a whole bunch of strange letters. So, I know I'm doing
this
wrong, but I just want a simple serialization. I'd prefer to not have any
SOAP envelopes and such in the data (This is the only sample I could find)

Give a try to the XMLFormatter, it saves only public properties and data
members, in a process called "shallow serialization." You will get rid of
SOAP headers this way.
Read about other Formatters in documentation (BinaryFormatter for example),
you will find somenthing that suits your needs for sure.

sincerely,
--
Sebastian Zaklada
Skilled Software
http://www.skilledsoftware.com
************************************
SQL Source Control 2003 - for
SQL Server Source Safe integration
and custom databases documentation
 
Back
Top