In .NET 3.5, I would like to create a custom attribute (say [NetDataMember]) that would switch the serialization behavior from DataContractSerializer
to NetDataContractSerializer
.
Basically, for a class A
as illustrated below
[DataContract]
class A
{
[DataMember]
public int SimpleProperty { get; set; }
[Transcient]
public IBar ComplexProperty { get; set; }
}
I would like to obtain a serializer that would behave like DataContractSerializer
by default, but that would be overriden with NetDataContractSerializer
for properties marked with [NetDataMember]
.
Any idea how to design a serializer that would achieve such behavior?