Deserialize from a string

  • Thread starter Thread starter Samuel
  • Start date Start date
S

Samuel

Hi

Instead of deserializing (to XML object) from a file I would like to do the
same from a string where the data is already.

Thank you,
Samuel
 
Samual,

As the file is a text file, then it is a string, so what is the real
problem?

Cor
 
Currently I pass the XML Deserializer the FileStram that is 'connected' to
the file. What I need is a stream connected to the string

Thank you,
Samuel
 
Currently I pass the XML Deserializer the FileStram that is 'connected' to
the file. What I need is a stream connected to the string

Thank you,
Samuel

Use a StringStream instead of a FileStream. That should work.

Chris
 
Currently I pass the XML Deserializer the FileStram that is 'connected' to
the file. What I need is a stream connected to the string

Thank you,
Samuel

I meant StringReader, not StringStream. You can pass an instance of
a StringReader into the Deserialize method of the XmlSerializer.

Chris
 
Back
Top