Feature Request: ref struct iterator #9745
Unanswered
UniqeId6542
asked this question in
Language Ideas
Replies: 2 comments 11 replies
-
|
This specification needs more information. As |
Beta Was this translation helpful? Give feedback.
10 replies
-
|
Probably falls under #982 |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
In C#, I can write an iterator (yield return). This compiles into a private class.
I can also write a ref struct enumerable. (It can be used in a foreach loop as long as the struct has Current, MoveNext, and GetEnumerator)
I'm requesting that iterators support spans (ref-struct). Any iterator with a span used across yield return statements will itself compile into a ref struct enumerable.
A complication is how try-finally and other cleanup would work. Some form of Dispose or Finalize would probably be necessary.
#1110
Beta Was this translation helpful? Give feedback.
All reactions