使用DataContractSerializer和快速序列化代码 [英] Using DataContractSerializer and the Fast Serialization code

查看:122
本文介绍了使用DataContractSerializer和快速序列化代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


我已经使用您的快速序列化"代码已有相当长的时间了,直到现在一直没有任何问题.
使用BinaryFormatter时,我可以使用出色的快速序列化程序代码进行序列化和反序列化,但是在使用DataContractSerializer时,我似乎无法使用它.

以下代码段适用于快速序列化器:

Hi,
i''ve been using your "Fast Serialization" code for quite some time, and up until now without any issues.
When working with BinaryFormatter, i''m able to serialize and de-serialize using your great fast serializer code, however i can''t seem to be able to use it when working with DataContractSerializer.

the following code snippet works with the fast serializer:

BinaryFormatter bformatter = new BinaryFormatter();
bformatter.Serialize(stream, dataset);
stream.Close();
bformatter = new BinaryFormatter();
TDataSetType newDs = (TDataSetType)bformatter.Deserialize(stream);
stream.Close();


以下代码不适用于快速序列化器:


the following code does not work with the fast serializer:

DataContractSerializer dcSerializer = new DataContractSerializer(typeof(TDataSetType));
dcSerializer.WriteObject(stream, dataset);
stream.Close();
dcSerializer = new DataContractSerializer(typeof(TDataSetType));
TDataSetType newDs = (TDataSetType)dcSerializer.ReadObject(stream);
stream.Close();


在使用DataContractSerializer时(与BinaryFormatter相对),我应该怎么做才能进入快速序列化器?

谢谢! ;)


What should i do in order to step into the Fast Serializer, also when using the DataContractSerializer (as oppose to the BinaryFormatter)?

Thanks! ;)

推荐答案

关于CP的所有文章的底部都是论坛.如果您的问题是针对某个文章的,则需要在该论坛中提问.

很可能这篇文章的作者不会看到您的快速回答问题,而我们大多数人可能从未看过这篇文章或使用其中的代码.

获得帮助的答案的最佳机会是在文章页面上的论坛中提问,而不是在此处.

祝你好运.
At the bottom of all of the articles on CP are forums. If your question is specific to an article, you need to ask your question in that forum.

Chances are that the author of the article won''t see your quick answer question and chances are that the majority of us have never seen the article or use the code in it.

Your best chance of getting an answer that helps is to ask it at the forum on the articles page, not in here.

Good luck.


这篇关于使用DataContractSerializer和快速序列化代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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