在使用DataContractSerializer时,有没有与XmlTextAttribute等效的工具?
当一个属性被序列化为XML时,我想将该属性作为'default属性‘来处理。例如:
[Serializable]
[DataContract]
public class Item
{
[DataMember]
public String Value
{
get;
set;
}
}将.Value设置为"foo“的对象序列化为:
<Item>foo</Item>而不是:
<Item><Value>foo</Value></Item>李
发布于 2009-03-12 17:32:46
我不认为使用DataContractSerializer可以做到这一点。
Marc
https://stackoverflow.com/questions/639462
复制相似问题