我試圖反序列化的代碼如何序列化屬性
<request>
<employee id="40407">Test User</employee>
</request>
我創建了一個類:
public class Request
{
public string employee { get; set; }
[XmlAttribute("employee/id")]
public string employeeId { get; set; }
}
沒有屬性一切正常,但我需要從屬性「id
」數據爲好。有一次,我把[XmlAttribute("employee/id")]
它不想工作。我做錯了什麼?
http://stackoverflow.com/questions/4154621/add-xml-attribute-to-string-property嘗試此鏈接以及給你一個非常需要的例子序列化 - >反序列化 - http://stackoverflow.com/questions/10805344/how-to-deserialize-an-xml-string – MethodMan