In C# Serialization I need to Serialize Object that references object in other DLL without source code
I need to Serialize Object that have another object as a field.
The problem is that this object being referenced is from another DLL that I don't have the code for it.
Therefore, I can't add the [Serializable]
attribute to it.
Any suggestions on how o开发者_高级运维 do it?
I was thinking to create my own Serializer
class, is there another way?
As far as I can tell, a custom serializer seems to be the appropriate approach.
Use a reflector to reconstruct the code and add the serializable tag to it.
You could use a SerializeSurrogate, see codeproject for more information.
精彩评论