【发布时间】:2012-01-06 15:52:44
【问题描述】:
我想反序列化这个 Xml:
<Content id="1">
<Element key="Description">Bla bla bla</Element>
<Element key="Title">The title</Element>
</Content>
进入这个类:
public class Content
{
[XmlAttribute(AttributeName = "id")]
public string Id
{
get { return _id; }
set { _id = value; }
}
[XmlAttribute(AttributeName = "description")]
public string Description
{
get;
set;
}
[XmlAttribute(XmlElement = "title")]
public string Title
{
get;
set;
}
}
我的问题是我不知道如何将正确属性的文本放入类属性中。
谢谢
【问题讨论】:
标签: c# xml deserialization xml-deserialization