我有一个问题,XML 元素“事件”由于 new 关键字而被序列化两次。我希望派生类型只被序列化。
[DataContract(Name = "Division", Namespace = "")]
public class ApiTeamDivision : ApiDivision
{
[DataMember]
public new ApiTeamEvent Event { get; set; }
[JsonIgnore]
public new ApiDivisionSettings Settings { get; set; }
[JsonIgnore]
public new List<ApiPrice> Prices { get; set; }
[JsonIgnore]
public new List<ApiTeam> Teams { get; set; }
[JsonIgnore]
public new List<ApiAsset> Assets { get; set; }
[JsonIgnore]
public new List<ApiBracket> Brackets { get; set; }
}
<Division>
<Age>17</Age>
<Event i:nil="true"/>
<Event>
<Address i:nil="true"/>
<Assets i:nil="true"/>
<Description i:nil="true"/>
<Divisions i:nil="true"/>
</Event>
</Division>