I have a couple of classes that look like this:
[DataContract]
public class A {
[DataMember(Order = 1)]
public virtual string SomeString{
get;
set;
}
}
[DataContract]
public class B : A {
[DataMember(Order = 1)]
public override string SomeString{
get{ // Do something }
set{ // Do something}
}
}
Do I need to include the DataMember attribute on SomeString in the derived class? Is the data contract for the derived class treated in isolation to the base class?
I followed jdweng's suggestion of actually inspecting the serialized data with and without the DataMember attribute on the derived class. The property SomeString was serialized for the derived class without the DataMember attribute on the SomeString property.