XmlSerializer. Keep null string properties? [duplicate]
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: XML Serialization and null value - C# change how XmlSerializer serializes empty elements How to make XmlSerializer store empty tags for string properties having null values, instead of skipping this property? 回答1: You mean you want this: <parent> <child1>Hello World</child1> <child2 /> </parent> instead of <parent> <child1>Hello World</child1> </parent> your class should look like this: The serializer calls a