string xml;
using (var writer = new StringWriter())
{
var serializer = new XmlSerializer(typeof(MyModel));
serializer.Serialize(writer, myModel);
xml = writer.ToString();
}
string xml;
using (var writer = new StringWriter())
{
var serializer = new XmlSerializer(typeof(MyModel));
serializer.Serialize(writer, myModel);
xml = writer.ToString();
}