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

UnreliableCode Community

Developer Research, Reverse Engineering & Coding Community

Tutorial

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

DirectXRay
DirectX 12 / Vulkan Dev
MEMBER
Rep: 240
Join Date: Feb 2023
Posts: 31
Thanks: 60
7mo ago · Dec 25, 2025 11:03 AM
#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.
DirectXRay · DirectX 12 & Vulkan Command Lists
The following users thanked DirectXRay for this post:
OffsetHunter
RTTI & NetVar Dumper
MEMBER
Rep: 175
Join Date: Jul 2024
Posts: 20
Thanks: 44
7mo ago · Dec 25, 2025 12:13 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.
OffsetHunter · RTTI TypeDescriptors & NetVars
KeycardMaster
Item ESP & Unity UI Dev
MEMBER
Rep: 215
Join Date: Oct 2023
Posts: 19
Thanks: 54
7mo ago · Dec 25, 2025 6:13 PM
#3
Also remember readonly record struct makes the data completely immutable, which helps the JIT optimize register allocation!
KeycardMaster | Keycard & Objective ESP Specialist