让 .NET Compact Framework 支持 Binnary Serialization

智能设备上的存储空间比较有限,如果能把内存中的数据保存为二进制文件,无论是执行效率还是存储空间,都比文本文件更具优势。为了更有效地利用存储空间,很多人想把对象序列化为二进制数据流并写入磁盘中,但恰恰在 .NET Compact Framework 里面就是找不到 Binnary Serialization 相关的类。
今天发现了一个叫 CompactFormatter 的组件,可以让你在 .NET CF 中实现二进制序列化。

What is the CompactFormatter?
The CompactFormatter is a generic formatter for the .NET Compact Framework. It is fully realized in .NET managed code and this means that it is able to work on every device able to support the .NET Compact Framework or every other standard-compliant CLI implementation.

Even if the CompactFormatter is able to serialize automatically the majority of objects using Reflection, it allows programmers to redefine the serialization algorithm of custom objects if this is needed ( such as, for example, if a custom serialization algorithm is more efficient than the standard one ).

The interface that the CompactFormatter class expose to the user is very similar to the BinaryFormatter ( or SOAPFormatter ) one and so using it ( or, to some extents, porting applications from .NET to it ) should be very simple for people who knows how to use standard .NET Full Formatters.

CompactFormatter is still in Beta (even if we reached 1.0.0 version) simply because it needs more testing. I hope to remove the beta status in a couple of months if no critical problems will be reported.

CompactFormatter is and will always be released under the LGPL License.

Features
·Able to serialize primitive types automatically.
·Able to serialize user-defined types automatically.
·Thanks to Surrogate and Overrider mechanism, allows a safer serialization even of framework types.
·Uses an interface very similar to standard Binary/SOAP formatters used in .NET
·Supports NotSerializable fields, that are fields which must not be serialized.
·Produces a data stream more compact than the one used by .NET BinaryFormatter.
·It is faster than BinaryFormatter and SOAPFormatter.
·Allows users to redefine serialization mechanism of their classes (Custom Serialization).
·It correctly rebuilds the object reference graph.
·Allows the use of user-defined StreamParsers, these are wrapper around serialization stream (useful to implement transformations just before sending the stream on the wire: soon available StreamParsers will allow zip compression and TEA data encryption out of the box.)
·Fully implemented in .NET managed code.

http://www.freewebs.com/compactFormatter/index.html

我还没有测试过,有需要在 .NET CF 下实现二进制序列化的朋友可以试一试:)

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。 经导师精心指导并认可、获 98 分的毕业设计项目!【项目资源】:微信小程序。【项目说明】:聚焦计算机相关专业毕设及实战操练,可作课程设计与期末大作业,含全部源码,能直用于毕设,经严格调试,运行有保障!【项目服务】:有任何使用上的问题,欢迎随时与博主沟通,博主会及时解答。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值