I had a quick question regarding the datacontractserializer. Maybe it\'s more of a stream question. I found a piece of code that writes the xml to a filestream. I basically don\
Something like this - put your output into a MemoryStream
and then read that back in:
public static string DataContractSerializeObject(T objectToSerialize)
{
using(MemoryStream memStm = new MemoryStream())
{
var serializer = new DataContractSerializer(typeof(T));
serializer.WriteObject(memStm, objectToSerialize);
memStm.Seek(0, SeekOrigin.Begin);
using(var streamReader = new StreamReader(memStm))
{
string result = streamReader.ReadToEnd();
return result;
}
}
}