ExtendedXmlSerializer / home

A configurable and eXtensible Xml serializer for .NET.
https://extendedxmlserializer.github.io/
MIT License
336 stars 47 forks source link

ShouldSerialize is not working. #607

Closed egalambos closed 8 months ago

egalambos commented 10 months ago

I have what's below and ShouldSerializeDefault is never called. Might this be because XmlElement has been defined??

    [XmlElement("DEFAULT_PRICING_DATA")]
    [JsonProperty(PropertyName="DEFAULT_PRICING_DATA")]
    public PricingData Default { get; set; }

    [XmlIgnore]
    public bool SaveDefaultValues { get; set; }

    public bool ShouldSerializeDefault()
    {
        return SaveDefaultValues;
    }
Mike-E-angelo commented 10 months ago

Hey there @egalambos thank you for your question and for writing in. We use a different approach from the classical serializer. You can find some examples here: https://github.com/ExtendedXmlSerializer/home/blob/4ab31a26cfa72fe4d27ee8de3b00f0366aea73b0/test/ExtendedXmlSerializer.Tests.ReportedIssues/Issue530Tests.cs#L34

Please let me know if you have any further questions; I will do my best to assist you.

Mike-E-angelo commented 8 months ago

Sounds like this issue was answered. If not please leave a comment and I will re-open. Closing this issue for now.