foreach (var entity in courses) yield return EntityToModel.CreateCourseFromEntity(entity);
foreach (var entity in courses) yield return EntityToModel.CreateCourseFromEntity(entity);
What is the reasoning behind yield return in this case? Im thinking a normal return would break the foreach and that there are no need for using yield.
When googling i found that the yield can be useful to reduce code(look at attached image for example) but i cant see how it is contributing to that in the case mentined above.