I am using BinaryFormatter to serialize a class and its variables by condition. For example:
[Serializable]
public class Class1
{
private Class2 B;
...
}
[S
ISerializable
, and if you do you will know which serialization context is active (remoting, file etc.)Generally speaking I advise you against using BinaryFormatter
. It is a maintenance headache if there ever was one. Use XML serialization or some kind of protocol buffers.