Created
October 4, 2011 23:56
-
-
Save einarwh/1263200 to your computer and use it in GitHub Desktop.
Using a broken record iterator
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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