Developer knowledge network · moderated exchange

UnreliableCode 커뮤니티

개발자 연구, 리버스 엔지니어링 및 코딩 커뮤니티

Knowledge index살다
4Categories
919Threads
2.8K게시물
Release

Roslyn Source Generator for Compile-Time Packet Serialization in C# [v2.4 Technical Discussion]

dotnet_native_aot
C# Veteran
MEMBER
대표: 174
가입 날짜: Sep 2021
게시물: 16
감사해요: 62
1개월 전 · Jul 4, 2026 3:08 PM
#1

Why use Roslyn Source Generators instead of Reflection in game tools:

Reflection inspects properties at runtime, generating runtime allocations and boxing.

Our Source Generator automatically writes pure C# binary serialization methods during compilation:

CSHARP
[GenerateBinaryPacker]
public partial struct PlayerStatePacket {
    public int PlayerId;
    public float Health;
    public Vector3 Position;
}
// Generator automatically emits: public void Serialize(Span<byte> dest) { ... }

Zero runtime reflection overhead, 100% compatible with NativeAOT!

netvar_ninja
Schema Master
MEMBER
대표: 145
가입 날짜: Nov 2018
게시물: 16
감사해요: 89
1개월 전 · Jul 4, 2026 9:40 PM
#2

Source generators are the cleanest way to serialize game network packets in C#. Big vouch.

vtable_slayer
Senior Reverser
MEMBER
대표: 215
가입 날짜: Mar 2018
게시물: 86
감사해요: 61
1개월 전 · Jul 5, 2026 1:26 AM
#3

Compile-time code generation is the future of .NET.