How is transforming this iterator block a functional change?
问题 Given the following code snippet: public class Foo { public IEnumerable<string> Sequence { get; set; } public IEnumerable<string> Bar() { foreach (string s in Sequence) yield return s; } } is the following snippet semantically equivalent, or is it different? If it is different, how do they function differently? public class Foo2 { public IEnumerable<string> Sequence { get; set; } public IEnumerable<string> Bar2() { return Sequence; } } This question is inspired by this question which is