Solved

New Iterator- Need help here Understanding its useage

Posted on 2013-05-14
3
171 Views
Last Modified: 2013-05-16
Just as the subject line says

I dont really understand this .... my question is .... can someone demonstrate a simple usage and explain why this is a benefit to me
0
Comment
Question by:vbMarkO
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
3 Comments
 
LVL 42

Assisted Solution

by:sedgwick
sedgwick earned 250 total points
ID: 39163891
Iterators is a feature since .net 2.0. and simply use yield return which means that the current location in code is remembered to return each element one at a time.
here's a nice example from msdn:
http://msdn.microsoft.com/en-us/library/vstudio/dscyy5s0.aspx
0
 

Author Comment

by:vbMarkO
ID: 39167106
Yes I am familiar with the examples there including the animals one and so on ....

And I read the articles concerning it but Im just not wrapping my head around it ...

I mean why would I want the current location in code remembered?

I am sure I am over looking the obvious ... was just hoping someone could give an example of how n why I might use it
0
 
LVL 83

Accepted Solution

by:
CodeCruiser earned 250 total points
ID: 39167449
I think Iterator is mainly used internally such as to implement the ForEach loops. I have never used it in my own code.
0

Featured Post

Learn by Doing. Anytime. Anywhere.

Do you like to learn by doing?
Our labs and exercises give you the chance to do just that: Learn by performing actions on real environments.

Hands-on, scenario-based labs give you experience on real environments provided by us so you don't have to worry about breaking anything.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
Come and listen to Percona CEO Peter Zaitsev discuss what’s new in Percona open source software, including Percona Server for MySQL (https://www.percona.com/software/mysql-database/percona-server) and MongoDB (https://www.percona.com/software/mongo-…
There's a multitude of different network monitoring solutions out there, and you're probably wondering what makes NetCrunch so special. It's completely agentless, but does let you create an agent, if you desire. It offers powerful scalability …

691 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question