1
我想知道是否可以有條件地排除列表中的項目使用ShouldSerialize*
模式進行序列化。例如採取兩類:列表項的條件XML序列化
public class Product{
public int ID {get; set;}
public List<Styles> ProductSyles {get; set;}
}
public class Styles{
public int ID {get; set;}
public bool Selected {get; set;}
public string StyleName {get; set;}
}
我可以去只有.Selected = true
序列化的ProductStyles
屬性中的項目?這是否可以使用ShouldSerialize*
模式
使列表成爲私人的,然後創建一個公共屬性過濾返回結果之前的列表。 – jdweng