jsonconvert序列化时避免序列化子类
类如下。在序列化时,尽管指定的是父类序列化。但实际会序列化掉子类。只需要把子类的字段定义为internal就可以了。
public class TransPortCustomers
\{
public string orderNumberERP \{ get; set; \}
public string customID \{ get; set; \}
public string customName \{ get; set; \}
public string customAddress \{ get; set; \}
public string contactName \{ get; set; \}
public string contactTel \{ get; set; \}
public string coldflag \{ get; set; \}
public Int32 caseqty \{ get; set; \}
public Int32 bagqty \{ get; set; \}
public string sendStatus \{ get; set; \}
\}
public class TransPortCustomersWithTransNO : TransPortCustomers
\{
internal string transNo \{ get; set; \}
\}
还没有评论,来说两句吧...