Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main(string[] args)
- {
- var index = 0;
- foreach (var result in Hello())
- {
- Console.WriteLine(result);
- index++;
- if (index >= 10)
- {
- break;
- }
- }
- Console.ReadLine();
- }
- private static IEnumerable<string> Hello()
- {
- while (true)
- {
- yield return "Hello World";
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement