serialization
✓為 .NET 應用程序選擇正確的序列化格式。優先選擇基於模式的格式(Protobuf、MessagePack)而不是基於反射的格式(Newtonsoft.Json)。將 System.Text.Json 與 AOT 源生成器結合使用以實現 JSON 場景。
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
詳情
- 分類
- </>開發工具
- 來源
- skills.sh
- 收錄時間
- 2026-02-06