9
votes
7answers
2k views

C# foreach improvements?

I run into this often during programming where I want to have a loop count index inside of a foreach and have to create an integer, use it, increment, etc. Wouldn't it be a good idea if there was a ...
4
votes
4answers
526 views

Decrementing/Incrementing loop variable inside for loop. Is this code smell?

I have to read lines from a text file in sequential order. The file is a custom text format that contains sections. If some sections are out of order, I would like to look for the starting of the next ...
0
votes
0answers
7 views

How to do looping in C# programming? [migrated]

I have to allow 20 balls to move around the screen. I would like to know how do I use a loop so I would not have to type the codes out long. Currently, the codes I have are for (int i = 0; i < ...