What are iterators?

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


Please Help Members By Posting Answers For Below Questions

What is a property in c#?

472


What are the 3 types of comments in c#?

522


What is .net console?

530


How can you force derived classes to provide new method implementations for virtual methods?

482


What is Wrapper class in dot net?

636






What is the max value of int32 in c#?

494


What is the delegate in c#?

494


What is lambda expression in c#?

506


What is delegate in c#?

544


What is out in c#?

514


3. Use layered architecture for coding. s.no name description 1 abc xxxxxxxxx 2 abc xxxxxxxxx 3 4 5 6 7 8 Select all Clear all Add Delete Name Description Save close

1455


What does a constructor do c#?

494


Distinguish between finally and finalize blocks?

511


How do you determine whether a string represents a numeric value?

516


What is response redirect in c#?

481