Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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

Is c# int immutable?

917


What is sealed class in c#?

895


what are the contents of an assembly ?

993


Define Abstract Class in C#

971


What is the use of return in c#?

952


What is a byte in c#?

980


Can we inherit private class in c#?

946


What are the namespace level elements?

988


What does the initial catalog parameter define in the connection string?

938


Why do we need static in c#?

962


Which .gang of four. Design pattern is shown below?

923


What is difference between float and integer?

992


Is string immutable in c#?

1004


Explain the difference between “constant” and “read-only” variables used in c#?

1032


I want to print "Hello" even before main() is executed. How will you achieve that?

901