【发布时间】:2014-02-18 18:56:33
【问题描述】:
对于 XMLSerialization,您使用 XML 标签来指示如何在序列化中添加属性/字段。
每个属性都有一个 XML 标记很丑。我理解具有明确性的价值,但它的眼睛很痛苦
我的问题是有一种方法可以做这样的事情,其中标签与块相关联?
public class Application : IApplication
{
[XmlAttribute]
public string Name { get; set; }
public string Source { get; set; }
[XmlElement]
public string Description { get; set; }
public string Icon { get; set; }
public string StoreLink { get; set; }
[XmlIgnore]
public string Branch { get; set; }
public string Version { get; set; }
public string Build { get; set; }
public bool IsDebug { get; set; }
public bool IsX86 { get; set; }
public override string ToString()
{
return Name;
}
}
【问题讨论】:
标签: c# xml serialization properties formatting