2014-02-18 32 views
0

对于XMLSerialization,您可以使用XML标记来指示如何在序列化中添加属性/字段。有没有办法将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; 
    } 
} 

回答

0

Apperently你可以做...

[XmlAttribute] public string Version; 
[XmlAttribute] public string Number; 

这是对眼睛更容易一些。

相关问题