Best way to serialize an object to a String

P

Patrick Sona

Hi all!

has anyone an idea how to serialize an object to a String without using
XMLSerializer? The problem is, that i have to serialize a Hashtable to a
String and the XMLSerializer doesn't accept any object that inherits
from ICollection. So I have to use the Binary or SoapFormater. But both
accept only a Stream and .net has no StringStream.

Thanx!

Greetings
Pat
 
P

Patrick Sona

Patrick said:
Hi all!

has anyone an idea how to serialize an object to a String without using
XMLSerializer? The problem is, that i have to serialize a Hashtable to a
String and the XMLSerializer doesn't accept any object that inherits
from ICollection. So I have to use the Binary or SoapFormater. But both
accept only a Stream and .net has no StringStream.

Thanx!

Greetings
Pat

I have found the solution by my self. The best way to serialize to a
String is using the MemoryStream, from which you can get a Bytearray.
This could be converted to a String!

Greetings
Pat
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top