T2o
T2o

Reputation: 925

Deserialization NOT from a file

I have a problem with deserialization. The Deserialize method only takes stream or text reader as argument, and my xml is not stored to a file, so I can't read it (or, I don't know how to read it).

In fact, I receive the xml from a Web Services method which returns a DataSet. I can have the XML with the use of "GetXML" method, but I cant use it with my deserialize()

Of course, I could use a XmlWriter to create an XML file with my data and read the file after to deserialize, but it doesn't look like a good method to me.

A little help would be greatly appreciated !

Upvotes: 2

Views: 39

Answers (1)

Hamlet Hakobyan
Hamlet Hakobyan

Reputation: 33381

Use StringReader class.

using(var reader = new StringReader(dataSet.GetXml()))
{
   .....
}

Upvotes: 2

Related Questions