Yield Sample

This sample shows how to create a list class which implements IEnumerable<int> and the yield keyword to enable foreach iteration over the contents of the list. Two properties are defined, one returning the odd numbers, the other returning the even numbers.

C# (23.8 KB)
 
 
 
 
 
(0)
446 times
Add To Favorites
11/30/2011
E-mail Twitter del.icio.us Digg Facebook