Answer Posted / srinivas.r
An iterator is a section of code that returns an ordered
sequence of values of the same type.
An iterator can be used as the body of a method, an
operator, or a get accessor.
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 whitespace in c#?
Explain attributes in c#?
What does dbml mean?
Why cannot you specify the accessibility modifier for methods inside the interface?
Can properties be private in c#?
What is stringbuilder c#?
Is exe is machine dependent?
Why attributes are used in c#?
What is the output of TextWriterTraceListener redirected?
What is the difference between add and addrange in c#?
What are assemblies?
Give some examples for built in datatypes in c#?
Which of these string definitions will prevent escaping on backslashes in c#?
What does convert toint32 mean?
What is serialization in c#?