Answer Posted / gp_bellamkonda
What Sumit suggested was correct.Adding few more points to
it.
--The iterator code uses the yield return statement to
return each element in turn. yield break ends the
iteration. For more information, see yield.
--Multiple iterators can be implemented on a class. Each
iterator must have a unique name just like any class
member, and can be invoked by client code in a foreach
statement as follows: foreach(int x in
SampleClass.Iterator2){}
--The return type of an iterator must be IEnumerable,
IEnumerator, IEnumerable<T>, or IEnumerator<T>.
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
Is c# int immutable?
What is sealed class in c#?
what are the contents of an assembly ?
Define Abstract Class in C#
What is the use of return in c#?
What is a byte in c#?
Can we inherit private class in c#?
What are the namespace level elements?
What does the initial catalog parameter define in the connection string?
Why do we need static in c#?
Which .gang of four. Design pattern is shown below?
What is difference between float and integer?
Is string immutable in c#?
Explain the difference between “constant” and “read-only” variables used in c#?
I want to print "Hello" even before main() is executed. How will you achieve that?