【发布时间】:2012-02-11 14:34:04
【问题描述】:
对于一个用属性[DataContract]标记的类,它的应该被序列化的私有字段是否被标记为[DataMember]?
例子:
[DataContract]
public class Component
{
// [DataMember] is not needed since public fields get automatically serialized
public int number;
// do I need [DataMember] here?
private string characters;
// [DataMember] is required here, but I also need to include the
// attribute [DataMember] in this class's definition
private complexType cT;
我正在正确阅读DataContractAttribute Class,对吗?
【问题讨论】:
标签: c# datacontract