何时使用ISerializable? [英] When to Use ISerializable?

查看:112
本文介绍了何时使用ISerializable?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在我正在创建的应用程序中使用二进制序列化进行文件存储。

现在,我正在使用带有[Serializable]属性的简单序列化。

现在,让我们说我创建了一个带有修改过的类结构的更高版本。我是

计划在我的课程上实现ISerializable和SerializationBinder

,以便能够阅读以前的版本文件。


是否可以推迟实施这些项目直到实际需要它们?

这是一个好主意吗?或者我最好从一开始就在我的所有课程中实现ISerializable吗?感谢您的建议。


Dave Veeneman

Foresight Systems,Inc。

I use binary serialization for file storage in an application I am creating.
Right now, I''m using simple serialization with a [Serializable] attribute.
Now, let''s say I create a later version with a modified class structure. I''m
planning to implement ISerializable and a SerializationBinder on my classes
at that time to enable reading prior version files.

Is it okay to defer implementing these items until they are actually needed?
Is it a good idea? Or would I be better off implementing ISerializable in
all my classes from the outset? Thanks for your advice.

Dave Veeneman
Foresight Systems, Inc.

推荐答案

戴夫,


这取决于你现在的优先级。如果你有其他的优先事项

并且需要开发那些,那么我会推迟,特别是如果你看到你的班级结构的

波动率很低。 />

但是,如果你看到你的班级结构在即将来临的

中发生变化,那么现在就开始工作吧。


如果你能坚持下去,我会等待惠德贝,因为

序列化的故事会有所改善。


希望这会有所帮助。 />
-

- Nicholas Paldino [.NET / C#MVP]

- mv*@spam.guard.caspershouse.com


" Dave Veeneman" <哒**** @ nospam.com>在消息中写道

news:ux ************** @ TK2MSFTNGP10.phx.gbl ...
Dave,

It depends on what your priority now is. If you have other priorities
and need to develop those, then I would hold off, especially if you see the
volatility of the structure of your classes being low.

However, if you see your class structure changing in the immediate
future, then do the work now.

If you can hold out, I would wait for Whidbey, as the story for
Serialization is going to be improved somewhat.

Hope this helps.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"Dave Veeneman" <da****@nospam.com> wrote in message
news:ux**************@TK2MSFTNGP10.phx.gbl...
我使用二进制序列化应用程序中的文件存储我是
创建。现在,我正在使用带有[Serializable]属性的简单序列化。
现在,让我们说我创建了一个带有修改过的类结构的更高版本。
我打算在我的
类上实现ISerializable和SerializationBinder,以便能够读取以前的版本文件。

是否可以推迟实现这些项目,直到它们为止实际上需要
?这是个好主意吗?或者我会从一开始就在所有课程中实施ISerializable会更好吗?感谢您的建议。

Dave Veeneman
Foresight Systems,Inc。
I use binary serialization for file storage in an application I am creating. Right now, I''m using simple serialization with a [Serializable] attribute.
Now, let''s say I create a later version with a modified class structure. I''m planning to implement ISerializable and a SerializationBinder on my classes at that time to enable reading prior version files.

Is it okay to defer implementing these items until they are actually needed? Is it a good idea? Or would I be better off implementing ISerializable in
all my classes from the outset? Thanks for your advice.

Dave Veeneman
Foresight Systems, Inc.



Didn''知道Whidbey正在改变序列化。感谢您的提示,以及

的建议。
Didn''t know Whidbey is changing Serialization. Thanks for the tip, and the
advice.


>
如果你能坚持下去,我会等待Whidbey,因为序列化的故事会有所改善。
If you can hold out, I would wait for Whidbey, as the story for
Serialization is going to be improved somewhat.




Ahem ...没有不尊重的意志Nicholas,但那是'相当活跃的目标,

你不觉得吗?我的意思是,我们正在寻找不少于6个月的时间,并且很可能在我检查的Whidbey发布之前一年内接近
。它已经被推迟了2,3倍b?除非他们的开发计划很长,否则我不建议人们为Whidbey功能持有他们的

气息

term。


Pete



Ahem... No disrespect intendend Nicholas, but that''s quite a moving target,
don''t you think? I mean, we''re looking at no less than 6 months and likely
closer to a year before the release of Whidbey last I checked. It''s already
been delayed what, 2, 3 times? I just wouldn''t recommend people hold their
breath for Whidbey features unless their development plans are pretty long
term.

Pete


这篇关于何时使用ISerializable?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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