KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I have this class: public class MySerializableClass { public List<MyObject> MyList { get; set; } } If MyList is null when MySerializableClass is serialized, I need to have it null when it's deserialised too, but the XmlSerializer always initializes it when it deserialises my class. Is there a way to avoid it initializing null properties? MyList is not even recorded in the serialized file when it's null. When I load it with null values, and save it again, MyList is not null anymore, it's serialized as a List<> with 0 items, but not null. Thanks. More info: An IsDeserializing property is not viable due to some code restrictions in the structure of the class
Tags (comma-separated)
Save Edits
Cancel