Easiest way to serialize an IParsable
I want to serialize IParsable<MyType> as <mns:MyType>MyType.ToString()</mns:MyType> in the context of a broader serialization requiring the DataContract serialization approach (readonly fields, etc.).
I have tried several ways, including ISerializable and ISerializationSurrogate, but they have all led to a lot of code that looks confusingly different to the DataContract attributes used throughout, and leaves me sure I'm using the wrong tools. It should be easy - MyType casts to and from string. What's the easiest way?
Comments
Post a Comment