本文介绍了有没有对象标记为可序列化招致开销?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在 [Serializable接口] 属性添加到类,这是否引入任何开销?怎么样,如果该类在任何序列化操作从未使用过?

If I add the [Serializable] attribute to a class, does this introduce any overhead? How about if the class is never used in any serialization operations?

推荐答案

这不任何开销增加正常运行时使用的对象。

This doesn't add any overhead to the normal runtime use of the object.

标记一类序列化甚至不导致元数据的大小不同。它只是规定了的typedef标志位。 (感谢 thecoop 指出了这一点)

Marking a class as Serializable doesn't even result in a size difference in metadata. It just sets a bit in the typedef flag. (Thanks to thecoop for pointing that out)

这篇关于有没有对象标记为可序列化招致开销?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

07-05 10:10