制作类,以序列化的缺点 [英] Disadvantage of making class to Serializable

查看:193
本文介绍了制作类,以序列化的缺点的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我使用Azure的缓存preVIEW和需要做出一些类序列化。

I'm using Azure Cache preview and need to make some classes Serializable.

有没有做类是可序列化的任何缺点 - 如性能问题

Is there any disadvantage of making class to be Serializable - such as performance issue?

[Serializable]
public class MyClass {}

我发现一些相关的问题,但他们不是缺点。

I found few related questions, but they are not about disadvantages.

  1. 是否所有的.NET异常序列化?

<一个href="http://stackoverflow.com/questions/1236857/drawbacks-of-marking-a-class-as-serializable">Drawbacks打标一类为Serializable

感谢提前

推荐答案

没有,有没有内在的开销只是在被标记为 [Serializable接口] 。唯一的问题我已经是的BinaryFormatter NetDataContractSerializer 是糟糕的序列化,和大多数其他序列化不感兴趣在这个标志(好吧,我可能是有偏见)

No, there is no intrinsic overhead simply in being marked as [Serializable]. The only problem I'd have is that BinaryFormatter and NetDataContractSerializer are lousy serializers, and most other serializers aren't interested in this flag (ok, I may be biased)

这篇关于制作类,以序列化的缺点的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆