I have a property
[XmlElement]
public string[] Emails { get; set; }
which is initialized as string[0] at constructor.
If I XML serialize and deserialize a default instance of this object, the property is NULL.
How can I tell the XML Serializer to use an empty array instead of NULL for this property?
5 years later... :) Replacing Array with List<> did the trick for me.
[XmlElement (IsNullable = false)]
public List<string> Emails {get;set;}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With