how can i serialize a class to a string ? i can write the data to a xml
file, but i would like to write to content into a string instead without
using a file...
I could write it to a xml file and from there into a string, but that would
not be the prefered method..
class test
{
public name;
public number;
}

Signature
gusse
www.gusse.net
johan.appelgren@gmail.com - 07 Mar 2006 14:40 GMT
How are you serializing your object? And can't you serialize to a
anything but a file?
johan.appelgren@gmail.com - 07 Mar 2006 14:56 GMT
How do you serialize it? Why can you only serialize to a file?
Chris Taylor - 07 Mar 2006 20:01 GMT
Hi,
Since you have not been very forth coming with information I will assume you
are referring to XmlSerializer.
If this is the case, you can pass the Serialize method an instance of a
StringWriter as the first argument, once the Serialize method returns you
can invoke ToString() on the StringWriter instance to get the Xml string.
Hope this helps

Signature
Chris Taylor
http://dotnetjunkies.com/weblog/chris.taylor
> how can i serialize a class to a string ? i can write the data to a xml
> file, but i would like to write to content into a string instead without
[quoted text clipped - 8 lines]
> public number;
> }