void WriteSimpleType(Type type, object val) { var serializer = new XmlSerializerFactory().CreateSerializer(type); XmlSerializerNamespaces xmlnsEmpty = new XmlSerializerNamespaces(); xmlnsEmpty.Add("", ""); serializer.Serialize(writer, val, xmlnsEmpty); }
void WriteDynamicType(Type type, object val) { writer.WriteElementString("Type", type.FullName); writer.WriteStartElement("Value"); var serializer = new XmlSerializerFactory().CreateSerializer(type); XmlSerializerNamespaces xmlnsEmpty = new XmlSerializerNamespaces(); xmlnsEmpty.Add("", ""); serializer.Serialize(writer, val, xmlnsEmpty); writer.WriteEndElement(); }