Solved

New Iterator- Need help here Understanding its useage

Posted on 2013-05-14
3
163 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
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

Master Your Team's Linux and Cloud Stack!

The average business loses $13.5M per year to ineffective training (per 1,000 employees). Keep ahead of the competition and combine in-person quality with online cost and flexibility by training with Linux Academy.

Question has a verified solution.

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

Suggested Solutions

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Today I had a very interesting conundrum that had to get solved quickly. Needless to say, it wasn't resolved quickly because when we needed it we were very rushed, but as soon as the conference call was over and I took a step back I saw the correct …
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…
This video shows how to use Hyena, from SystemTools Software, to bulk import 100 user accounts from an external text file. View in 1080p for best video quality.

809 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