question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Provide separate `yield return` and `yield break` completions instead of a single `yield`

See original GitHub issue

Considering 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:closed
  • Created 10 months ago
  • Comments:7 (6 by maintainers)

github_iconTop GitHub Comments

1reaction
jasonmalinowskicommented, Nov 15, 2022

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.

0reactions
CyrusNajmabadicommented, Nov 13, 2022

Sorry, what do you mean by that?

I would ‘not’ change this.

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found