为什么 CLR 对象类型是可序列化的?
我惊讶地发现 Object 类 装饰有可序列化属性。尽管对象实例可能很有用(例如,对于线程同步),但它们没有可以有意义地存储或重新组合的状态。如果 CLR Object 类没有标记为可序列化,会遇到什么问题?
I am surprised to find that the Object class is decorated with the Serializable attribute. Although Object instances can be useful (for thread synchronization, for instance), they have no state that can be meaningfully stored or re-hydrated. What problems would have encountered if the CLR Object class had not been marked as serializeable?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
如果它不可序列化,则 .NET 中的其他类型都无法序列化,因为所有类型最终都派生自
System.Object
。If it was not serializable, no other type in .NET would be serializable given that all types derive eventually from
System.Object
.