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\
I suggest combining the methods given by Pat and marc_s:
public static string DataContractSerializeObject(T objectToSerialize)
{
using (var output = new StringWriter())
using (var writer = new XmlTextWriter(output) {Formatting = Formatting.Indented})
{
new DataContractSerializer(typeof (T)).WriteObject(writer, objectToSerialize);
return output.GetStringBuilder().ToString();
}
}