Tag: xmlignore

在嵌套属性上使用XmlAttributeOverrides

我正在尝试使用XmlAttributeOverrides来控制在序列化类之后哪些类属性出现在xml中。 它适用于“根”类上的属性,但不适用于嵌套属性。 这是一个简单的例子来说明我想要完成的事情。 我的类层次结构如下: public class Main { public string Name { get; set; } public Location Address { get; set; } } public class Location { public string StreetAddress { get; set; } public Contact ContactInfo{ get; set; } } public class Contact { public string PhoneNumber { get; set; } public string EmailAddr […]