我用的是XML序列化,但是当我切换到二进制序列,它抛出一个异常:为什么二进制序列化要求将对象标记为可序列化?
Runtime error: dotNet runtime exception: Type 'MyTypes.MyObject' in Assembly 'MyTypes, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' is not marked as serializable.
为什么比它要求这种方式的XML序列化有什么不同?
只是标记对象序列化是足以解决这个问题?我不想指定序列化应该如何发生。