Skip to content

Instantly share code, notes, and snippets.

@einarwh
Created October 4, 2011 23:56
Show Gist options
  • Save einarwh/1263200 to your computer and use it in GitHub Desktop.
Save einarwh/1263200 to your computer and use it in GitHub Desktop.
Using a broken record iterator
var words = new [] { "Hello", "dear", "friend" };
int wordCount = 0;
foreach (string s in new BrokenRecord(words))
{
Console.WriteLine(s);
if (++wordCount == 10) { break; }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment