·serialization
</>

serialization

aaronontheweb/dotnet-skills

为 .NET 应用程序选择正确的序列化格式。优先选择基于模式的格式(Protobuf、MessagePack)而不是基于反射的格式(Newtonsoft.Json)。将 System.Text.Json 与 AOT 源生成器结合使用以实现 JSON 场景。

24安装·0热度·@aaronontheweb

安装

$npx skills add https://github.com/aaronontheweb/dotnet-skills --skill serialization

SKILL.md

| Examples | Protobuf, MessagePack, System.Text.Json (source gen) | Newtonsoft.Json, BinaryFormatter | | Type info in payload | No (external schema) | Yes (type names embedded) | | Versioning | Explicit field numbers/names | Implicit (type structure) | | Performance | Fast (no reflection) | Slower (runtime reflection) | | AOT compatible | Yes | No |

Recommendation: Use schema-based serialization for anything that crosses process boundaries.

| REST APIs | System.Text.Json (source gen) | Standard, AOT-compatible | | gRPC | Protocol Buffers | Native format, excellent versioning | | Actor messaging | MessagePack or Protobuf | Compact, fast, version-safe | | Event sourcing | Protobuf or MessagePack | Must handle old events forever | | Caching | MessagePack | Compact, fast |

查看原文

可引用信息

为搜索与 AI 引用准备的稳定字段与命令。

安装命令
npx skills add https://github.com/aaronontheweb/dotnet-skills --skill serialization
分类
</>开发工具
认证
收录时间
2026-02-06
更新时间
2026-02-18

快速解答

什么是 serialization?

为 .NET 应用程序选择正确的序列化格式。优先选择基于模式的格式(Protobuf、MessagePack)而不是基于反射的格式(Newtonsoft.Json)。将 System.Text.Json 与 AOT 源生成器结合使用以实现 JSON 场景。 来源:aaronontheweb/dotnet-skills。

如何安装 serialization?

打开你的终端或命令行工具(如 Terminal、iTerm、Windows Terminal 等) 复制并运行以下命令:npx skills add https://github.com/aaronontheweb/dotnet-skills --skill serialization 安装完成后,技能将自动配置到你的 AI 编程环境中,可以在 Claude Code 或 Cursor 中使用

这个 Skill 的源码在哪?

https://github.com/aaronontheweb/dotnet-skills