readonly struct looks like a performance win.
❌ Hidden cost
-
Defensive copies are created when passed by value
-
Happens silently in method calls
✅ Fix
Pass by in:
void Process(in MyStruct value)
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
readonly struct looks like a performance win.
Defensive copies are created when passed by value
Happens silently in method calls
Pass by in:
void Process(in MyStruct value)