Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

To gain the best performance possible using the xml serializer, a model should implement the ICustomXmlSerializable interface.

Code Block
public class CustomJsonSerializationModelCustomXmlSerializationModel : ModelBase, ICustomJsonSerializableICustomXmlSerializable
{
    public string FirstName
    {
        get { return GetValue<string>(FirstNameProperty); }
        set { SetValue(FirstNameProperty, value); }
    }

    public static readonly PropertyData FirstNameProperty = RegisterProperty("FirstName", typeof(string), null);

    void ICustomXmlSerializable.Serialize(XElement xmlElement)
    {
        xmlElement.Add(new XElement("FirstName")
        {
            Value = FirstName
        });
    }

    void ICustomXmlSerializable.Deserialize(XElement xmlElement)
    {
        FirstName = xmlElement.Element("FirstName").Value;
    }
}

...