You can change the value of the data item before serialization (to the default value, so it cannot be serialized), but then after serialization, you change it back - using the [OnSerializing] and [OnSerialized] callbacks (more information in this blog post ). This works great if you don't have multiple threads that serialize the object at the same time.
public class StackOverflow_8010677 { [DataContract(Name = "Person", Namespace = "")] public class Person { [DataMember] public string Name; [DataMember(EmitDefaultValue = false)] public int Age; private int ageSaved; [OnSerializing] void OnSerializing(StreamingContext context) { this.ageSaved = this.Age; this.Age = default(int);
source share