How to cook a loop(osmirnov.net)

submitted by splovesplove(24) 9 months, 29 days ago

With coming of Linq we rarely write loops. Actually, the most part of data fetching tasks, those earlier was done by loops, today could be simply done by Linq-to-Objects. Nevertheless, the loops are widely used for different scenarios and a developer should try to write a good loop. This post was written for beginners, but I hope that experienced developers will find in it something useful.

1 comment |category: |Views: 35

tags: another

new Add a live kick counter to your blog >> liveImage

You can even customize the image by choosing your own colors, and then clicking the button below to update the preview and the html code:

  • "Kick It" text
  • "Kick It" background
  • kick count text
  • kick count background
  • border

Simply copy and paste this HTML into your blog post.


Users who kicked this story:
Comments:

posted by dpetersondpeterson(4397) 9 months, 29 days ago 0

Some interesting talking points, particularly the interaction of loops and closures.
The only thing that irks me about the for loop example he used is that it seems much cleaner to step backwards through the array, rather than decrementing i when removing an item and fighting the loop. Simply change it to
for (var i = numbers.Count; i > 0; i--)
and you can simply remove the item from the array when you feel like it. :-)

Reply

information Login or create an account to comment on this story