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
What is difference between c and c sharp?
What are the different states of a thread?
What is garbage collection? How to force garbage collector to run?
What is a bool in c#?
What are the properties in c#?
Explain what a diffgram, and a good use for one Define diffgram? How it be used?
What is parsing?
Why do we need abstract class?
What is arraylist class in c#?
What is the implicit name of the parameter that gets passed into the class set method?
What is the syntax for calling an overloaded constructor within a constructor (this() and constructorname() does not compile)?
Where do we use serialization in c#?
Define c# i/o classes? List the commonly used classes?
What are the types of access modifiers?
Does c# have a 'throws' clause?