Provide separate `yield return` and `yield break` completions instead of a single `yield`
See original GitHub issueConsidering that yield
is only valid as a part of yield return
or yield break
it makes more sense to provide these 2 separate completions instead of a single yiled
in order to reduce typing needs. Rider does it exactly this way.
If this suggestion is accepted I would like to take it as it seems pretty simple for me.
Issue Analytics
- State:
- Created 10 months ago
- Comments:7 (6 by maintainers)
Top Results From Across the Web
c# - What's the use of yield break?
Break just breaks out of the loop, yield break ends the method completely. I guess the reason return isn't used is because you're...
Read more >Offer a combined yield return and yield break syntax #815
I'm thinking that the need to yield a single result and immediately break the iterator is a pretty uncommon pattern that doesn't necessitate...
Read more >How To Use The yield break Statement In C#? - Code Maze
In this article, we'll take a look at the yield break statement in C# and how they differ from return and break statements....
Read more >How to Use Generators and yield in Python
In this case, open() returns a generator object that you can lazily iterate through line by line. However, file.read().split() loads everything into memory ......
Read more >yield statement - provide the next element in an iterator
The yield statement has the two following forms: yield return : to provide the next value in iteration, as the following example shows:....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Assigning to @CyrusNajmabadi to keep driving the conversation, but yes, this is tricky. I think @DoctorKrolic might be on to something to put yield break/return along with the classic one, but I’d still be hesitant to see the original removed without some extra telemetry guiding that most folks were just selecting a new one.
I would ‘not’ change this.