.NET Core 中的二进制序列化 [英] Binary serialization in .NET Core

查看:38
本文介绍了.NET Core 中的二进制序列化的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在处理一个 .NET Core 项目,我正在尝试将我的 List 解析为 byte[].使用 .NET Framework,我们可以通过使用 BinaryFormatter 实现相同的效果,但是在撰写此问题时,Microsoft 似乎尚未在 .NET Core 中支持它,并且似乎没有即将发布的版本这样做.

I am working on a .NET Core project and I am trying to parse my List<T> to byte[]. Using the .NET Framework, we could have achieved the same by using BinaryFormatter, but at the time of writing this question it looks like Microsoft does not yet support it in .NET Core and no upcoming releases seem to do that.

谁能告诉我如何在 .NET Core 中执行这种序列化?此外,二进制序列化是否依赖于平台,因此在 .NET Core 中已被弃用?

Can anybody tell how to perform this serialization in .NET Core? Also, is binary serialization platform-dependent, and for such reason been deprecated in .NET Core?

推荐答案

你可以使用 Binaron.Serializer - https://github.com/zachsaw/Binaron.Serializer无需使用任何属性装饰您的类.

You can use Binaron.Serializer - https://github.com/zachsaw/Binaron.Serializer There's no need to decorate your class with any attributes.

免责声明:我是 Binaron.Serializer 的作者.

Disclaimer: I'm the author of Binaron.Serializer.

这篇关于.NET Core 中的二进制序列化的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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