Best way to serialize an object to a String

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Patrick Sona

    #1

    Best way to serialize an object to a String

    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
  • Patrick Sona

    #2
    Re: Best way to serialize an object to a String

    Patrick Sona schrieb:
    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

    Comment

    • sloan

      #3
      Re: Best way to serialize an object to a String


      Take a peak here
      http://sholliday.space s.live.com/Blog/cns!A68482B9628 A842A!114.entry
      about
      XmlSerializatio n with IDictionary and CollectionBase Objects
      including a Hashtable.



      "Patrick Sona" <sona@Flexsecur e.dewrote in message
      news:uNCjMfy6IH A.1420@TK2MSFTN GP06.phx.gbl...
      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

      Comment

      Working...