I'm having trouble serializing types acquired through WCF mex endpoint point, if I use those types to display data in WPF.
This is because the auto generated types do Implement the INotifyPropertyChanged interface, and because WPF binding subscribes to it.
The normal way of doing this would be adding [field: NonSerialized] to the event declaration. I don't want to do this, because the classes were auto generated.
I also do not want to switch to DataContractSerializer, mostly because I find BinaryFormatter that I'm using rather convenient in all other cases.
What I'd like to do is to find a field, in which event data is stored and mark it as NonSerialized before the serialization begins using reflection.
Here are my questions:
- Is it possible to add attributes at runtime?
- How do I find the field associated with the event?