日期:2014-05-17  浏览次数:20891 次

XML 特性 求助
这种节点形式我要怎么才能标记才能得到
<upgradeGoods num="2">3ldsjf2dl</upgradeGoods>
现在我是
 public class UpgradeGoods
  {
  /// <summary>
  /// 卖品编码/套餐编码
  /// </summary>
  [XmlAttribute("num")]
  public string ItemNum { get; set; }
  public string GoodsInfoId { get; set; }
  }
得到的结果是
<upgradeGoods num="
<GoodsInfoId>
3ldsjf2dl
</GoodsInfoId>
</upgradeGoods>

------解决方案--------------------
试一试

C# code

public class UpgradeGoods
  {
  /// <summary>
  /// 卖品编码/套餐编码
  /// </summary>
  [XmlAttribute("num")]
  public string ItemNum { get; set; }
 [XmlText]
  public string GoodsInfoId { get; set; }
  }