What concrete type does 'yield return' return?
问题 What is the concrete type for this IEnumerable<string> ? private IEnumerable<string> GetIEnumerable() { yield return "a"; yield return "a"; yield return "a"; } 回答1: It's a compiler-generated type. The compiler generates an IEnumerator<string> implementation that returns three "a" values and an IEnumerable<string> skeleton class that provides one of these in its GetEnumerator method. The generated code looks something like this*: // No idea what the naming convention for the generated class is