|
using System;
using System.Xml;
using System.Xml.Serialization;
namespace XmlSerializersTest.Serializers
{
class StandardXmlSerializer : IXmlSerializer
{
public string Name { get { return "Standard"; } }
public void Serialize(object obj, XmlWriter writer)
{
var serializer = new XmlSerializer(obj.GetType());
serializer.Serialize(writer, obj, GetNamespaces());
}
public object Deserialize(XmlReader reader, Type typeToDeserialize)
{
var serializer = new XmlSerializer(typeToDeserialize);
return serializer.Deserialize(reader);
}
private static XmlSerializerNamespaces GetNamespaces()
{
var result = new XmlSerializerNamespaces();
result.Add("", "");
return result;
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
Ivan is a hands-on software architect/technical lead working for Thomson Reuters in the New York City area. At present I am mostly building complex multi-threaded WPF application for the financial sector, but I am also interested in cloud computing, web development, mobile development, etc.
Please visit my web site:
www.ikriv.com.