[英]C# - YAXLib: How to ignore properties
I have to create XML document in the following format using YAXLib library我必须使用 YAXLib 库以以下格式创建 XML 文档
<Orders>
<Order>
<ItemNumber>
<QTY>10</QTY>
</ItemNumber>
<WareHouse>PA019</WareHouse>
</Order>
</Orders>
I have the following class structure我有以下 class 结构
public class Orders
{
private List<Order> _orders = new List<Order>();
public List<Order> OrderList
{
get { return _orders; }
}
}
public class Order
{
[YAXElementFor("")]
[YAXSerializeAs("ItemNumber")]
public string ItemNumber { get; set; }
[YAXElementFor("ItemNumber")]
[YAXSerializeAs("QTY")]
public int QTY { get; set; }
[YAXElementFor("")]
[YAXSerializeAs("WareHouse")]
public string WareHouse { get; set; }
}
but whenever I use the above class structure, OrderList tag also appear as well但是每当我使用上面的 class 结构时,OrderList 标签也会出现
Any idea on ignoring the tags in C# - YAXLib, what attribute need to add?, [YAXIgnore] not found关于忽略 C# - YAXLib 中的标签的任何想法,需要添加什么属性?,[YAXIgnore] 未找到
You need to use the [YAXDontSerialize] attribute.您需要使用 [YAXDontSerialize] 属性。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.