Loop variables are captured by reference.
❌ Bug
Perfectly compiled, logically broken code.
✅ Fix
Create a local copy inside the loop.
Daily micro-tips for C#, SQL, performance, and scalable backend engineering.
Loop variables are captured by reference.
Perfectly compiled, logically broken code.
Create a local copy inside the loop.