In wcf, what is the difference between applying the DataMember
attribute on a property
private int m_SomeValue;
[DataMember]
public int SomeVal
As long as you use the Name
marker, the contract is identical regardless of whether the field or property is used.
[DataMember(Name="SomeValue")]
private int m_SomeValue;
However, there may be some permissions issues accessing private members, in particular on silverlight and CF - in which case I would recommend using the public property as the data-member. Actually, I would tend to always use a property unless I had a very good reason...