|
|
|
|
|
by manigandham
2902 days ago
|
|
Those are 3 options, and have different nuance. They also were added to the language in later versions but you can use what you what works, I find it hard to see how that makes the language incoherent as if multiple options are bad. What exactly changed with a for loop? The runtime is different from the c# programming language. Originally when this all started, Windows was the focus and Linux/open-source were not an option, so saying it should be there from v1 doesn't fit when there was only one OS that it was planned to run on. |
|
I got it wrong, it was foreach, not for.
The semantics for the variable were wrong when given into a closure, it was a breaking change in C# 5.0 to fix it.
https://www.jetbrains.com/help/resharper/AccessToForEachVari...
https://stackoverflow.com/questions/12112881/has-foreachs-us...
Thing is, there isn't just one version of Windows, and updating the CLR in place can be lots of fun, to the point many enterprise postpone it ad infinitum.
This was the original driving idea for .NET Core, when ASP team started doing it, making it easy to allow IT to update Windows production servers to newer versions, porting to other platforms came afterwards.