What is the proper pattern for handling Enumerable objects with a yield return?
问题 Does there exist a standard pattern for yield returning all the items within an Enumerable? More often than I like I find some of my code reflecting the following pattern: public IEnumerable<object> YieldReturningFunction() { ... [logic and various standard yield return] ... foreach(object obj in methodReturningEnumerable(x,y,z)) { yield return obj; } } The explicit usage of a foreach loop solely to return the results of an Enumerable reeks of code smell to me. Obviously I could abandon the