Solved

New Iterator- Need help here Understanding its useage

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

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
vb.net class 3 21
Generate Numbers in JQuery file 11 66
MailAddress in vb 4 29
Upgrade code from VS 2010 to VS 2015 7 16
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

839 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