Top "Yield-return" questions

yield return is a C# construct that's used to create an iterator block, which makes implementing IEnumerable<T> easier.

Proper use of 'yield return'

The yield keyword is one of those keywords in C# that continues to mystify me, and I've never been confident …

c# yield-return
Using IEnumerable without foreach loop

I've gotta be missing something simple here. Take the following code: public IEnumerable<int> getInt(){ for(int i = 0; …

c# ienumerable yield-return
TypeError: 'generator' object has no attribute '__getitem__'

I have written a generating function that should return a dictionary. however when I try to print a field I …

python python-2.7 dictionary yield yield-return
When NOT to use yield (return)

This question already has an answer here: Is there ever a reason to not use 'yield return' when returning an …

c# .net yield yield-return
Return all enumerables with yield return at once; without looping through

I have the following function to get validation errors for a card. My question relates to dealing with GetErrors. Both …

c# ienumerable yield yield-return
Is there a Java equivalent to C#'s 'yield' keyword?

I know there is no direct equivalent in Java itself, but perhaps a third party? It is really convenient. Currently …

java yield yield-return
yield return with try catch, how can i solve it

I've a piece of code: using (StreamReader stream = new StreamReader(file.OpenRead(), Encoding)) { char[] buffer = new char[chunksize]; while (stream.…

c# .net-3.5 try-catch yield-return
Yield String from List[Char]

I have a l: List[Char] of characters which I want to concat and return as a String in one …

scala yield yield-return
In C#, why can't an anonymous method contain a yield statement?

I thought it would be nice to do something like this (with the lambda doing a yield return): public IList&…

c# yield anonymous-methods yield-return
What is the purpose/advantage of using yield return iterators in C#?

All of the examples I've seen of using yield return x; inside a C# method could be done in the …

c# iterator yield-return