return IEnumerable : IEnumerable : Class Interface C# Source Code


Custom Search

C# Source Code » Class Interface » IEnumerable »

 

return IEnumerable








    
 


using System;
using System.Collections.Generic;

class IteratorDemo {
    static IEnumerable<int> OneTwoThree() {
        Console.WriteLine("Returning 1");
        yield return 1;
        Console.WriteLine("Returning 2");
        yield return 2;
        Console.WriteLine("Returning 3");
        yield return 3;
    }
    static void Main() {
        foreach (var number in OneTwoThree()) {
            Console.WriteLine(number);
        }
    }
}

 
    
   
  
   







HTML code for linking to this page:

Follow Navioo On Twitter

C# Source Code

 Navioo Class Interface
» IEnumerable