Home / Forums / How to use C# 10 Record Structs vs Standard Structs for Game Math [Discussion #10]

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

How to use C# 10 Record Structs vs Standard Structs for Game Math [Discussion #10]

CitizenNative
RAGE Engine & FiveM Dev
VIP
Rep: 315
Join Date: Sep 2022
Posts: 21
Thanks: 82
8mo ago · Dec 7, 2025 5:39 PM
#1
Sharing a comparison between record struct and standard struct in C# 10+. Record structs automatically generate value-based equality, GetHashCode, ToString, and with { } non-destructive mutation expressions.
CitizenNative | RAGE Engine & FiveM Native Calls
The following users thanked CitizenNative for this post:
ImGuiStyler
ImGui Animation Specialist
MEMBER
Rep: 210
Join Date: Mar 2024
Posts: 22
Thanks: 55
8mo ago · Dec 7, 2025 9:16 PM
#2
The with { } operator on record structs is so clean: var moved = point with { X = point.X + 10 }; It copies the struct on the stack with the modified field in one line.
ImGuiStyler | Clean Custom UI Controls & Easing
NeighborSpy
Unity & Secret Neighbor Modder
VIP
Rep: 290
Join Date: May 2023
Posts: 17
Thanks: 76
8mo ago · Dec 8, 2025 3:16 AM
#3
Also remember readonly record struct makes the data completely immutable, which helps the JIT optimize register allocation!
NeighborSpy · Secret Neighbor & Unity Netcode
PlayerRole, Keycards, Basement Locks & Stamina inspection