commas for multiple yield returns #5098
Replies: 3 comments 4 replies
-
How does this compare with the shorter |
Beta Was this translation helpful? Give feedback.
-
To add further to this, it would be nice if there was a way to yield return a collection of elements. For example, IEnumerable<T> Concat<T>(IEnumerable<T> a, IEnumerable<T> b)
{
yield return a;
yield return b;
} The syntax would obviously have to differ to indicate that a collection is being iterated and each of its elements are being yield returned, instead of the collection being returned as a single element. Some ideas for that syntax:
|
Beta Was this translation helpful? Give feedback.
-
Or let's borrow from yield* x; |
Beta Was this translation helpful? Give feedback.
-
If we could use commas for multiple
yield return
s it would save a bit of syntax.Before (current):
After:
Beta Was this translation helpful? Give feedback.
All reactions