for to foreach loop and .Net framework version
I am cleaning up some old codebase written for .Net Framework 2.0
After experimentation I find that the Code Inspection: "For-loop can be converted into foreach-loop" does not show until you change the framework to .Net 3.5 or higher. Is there a reason for this not being available on earlier versions?
Please sign in to leave a comment.
Hello!
Thank you for the feedback.
Turns out it's an issue, I've reported it here -https://youtrack.jetbrains.com/issue/RSRP-474877.
You are welcome to comment or vote for it.
Thank you.
I have also noted that the following code does not trigger the Code Inspection: "For-loop can be converted into foreach-loop"
for (int i = 0; i != list.Count; i++)
Only when < is used for comparison does the code inspection trigger
Would that be another issue?
Hello!
We've introduced this inspection for the patterns of frequent occurrence. The specified case doesn't happen to be so commonly used.
Thank you.