Why doesn’t C# support local static variables like C does? [closed]

Because they screwed up, and left out a useful feature to suit themselves.

All the arguments about how you should code, and what’s smart, and you should reconsider your way of life, are pompous defensive excuses.

Sure, C# is pure, and whatchamacallit-oriented. That’s why they auto-generate persistent locals for lambda functions. It’s all so complicated. I feel so dumb.

Loop scope static is useful and important in many cases.

Short, real answer, is you have to move local statics into class scope and live with class namespace pollution in C#. Take your complaint to city hall.

Leave a Comment