title: Is it possible to do .NET binary serialization of an object when you don't have the source code of the class?
body: <p>I am using <code>BinaryFormatter</code> to do binary serialization of some objects in C#. However, some of the objects contain classes that I access via a DLL and do not have the source code for, so I can't mark them with the <code>Serializable</code> attribute. Is there a straightforward way to serialize them anyway? I have a workaround which involves taking class <code>NoSource</code> and making a new class <code>SerializableNoSource</code> for which the constructor takes a <code>NoSource</code> object and extracts all the information I need from it, but it's hacky. Are there any better alternatives?</p>