"yield all" construction as syntactic sugar over foreach yielding of enumerables #9093
Replies: 2 comments
-
Dup of #378 |
Beta Was this translation helpful? Give feedback.
0 replies
-
Closing as dupe. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Adding "yield all" as syntactic sugar over
foreach
for enumerables will make working with them more intuitive and convenient. It also resonates with patern machining, in a way close to natural language (i.e.if (value is not null)
...).This code is simpler and easier to understand than the traditional
foreach
loop withyield return item
;. It also aligns with the existing constructionyield break;
.Such functionality does not require a significant change in the operating principles; it can be achieved by simply using a cyclic yield return under the hood.
Beta Was this translation helpful? Give feedback.
All reactions