The following example describes how to implement yield return over foreach using c# .net. Create a method or a property with IEnumerable as the return type. Then somewhere in the method call yield return for each value you intent to have in the collection.