public static string SerializeType(Type aType, object aObject)
{
XmlSerializerNamespaces lXmlSerializerNamespaces = new XmlSerializerNamespaces();
lXmlSerializerNamespaces.Add("", "");
XmlSerializer lXmlSerializer = new XmlSerializer(aType);
XDocument lXDocument = new XDocument();
using (XmlWriter lXmlWriter = lXDocument.CreateWriter())
{
XmlWriterSettings lXmlWriterSettings = lXmlWriter.Settings;
lXmlWriterSettings.OmitXmlDeclaration = true;
lXmlSerializer.Serialize(lXmlWriter, aObject, lXmlSerializerNamespaces);
lXmlWriter.Close();
}
return lXDocument.ToString();
}
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment