I can serialize a List if the list is not null.
But if this list is null, I get an empty list on deserialization.
What do I have to do in order to get null on deserialization, when the list was null on serialization?
Here are my attempts so far:
[System.Xml.Serialization.XmlArray("WorksButIsNoList", IsNullable = true)]
public MyClass[] WorksButIsNoList { get; set; }
[System.Xml.Serialization.XmlArray("ThrowsException", IsNullable = true)]
public List<MyClass> ThrowsException { get; set; }
[System.Xml.Serialization.XmlElement("IsntNull", IsNullable = true)]
public List<MyClass> IsntNull { get; set; }
[System.Xml.Serialization.XmlElement("ThrowsException2", IsNullable = true)]
public List<int> ThrowsException2 { get; set; }
[System.Xml.Serialization.XmlElement("IsntNull2", IsNullable = true)]
public List<int?> IsntNull2 { get; set; }