Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1081181
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T22:08:11+00:00 2026-05-16T22:08:11+00:00

I am a VB.Net developer, kind of newbie in C#, While looking in C#

  • 0

I am a VB.Net developer, kind of newbie in C#,
While looking in C# documentation I came through Iterators and Generators, could not fully understand the use, I there anyone who can explain (in vb perceptive; if possible)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T22:08:12+00:00Added an answer on May 16, 2026 at 10:08 pm

    Iterators are an easy way to generate a sequence of items, without having to implement IEnumerable<T>/IEnumerator<T> yourself. An iterator is a method that returns an IEnumerable<T> that you can enumerate in a foreach loop.

    Here’s a simple example:

    public IEnumerable<string> GetNames()
    {
        yield return "Joe";
        yield return "Jack";
        yield return "Jane";
    }
    
    foreach(string name in GetNames())
    {
        Console.WriteLine(name);
    }
    

    Notice the yield return statements: these statement don’t actually return from the method, they just “push” the next element to whoever is reading the implementation.

    When the compiler encounters an iterator block, it actually rewrites it to a state machine in a class that implements IEnumerable<T> and IEnumerator<T>. Each yield return statement in the iterator corresponds to a state in that state machine.

    See this article by Jon Skeet for more details on iterators.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am a ASP.NET Developer trying to learn Rails and RESTful approach. To understand,
I'm a C#/.NET developer looking to mess around with something completely different - something
I'm an ASP.NET developer who has used Microsoft SQL Server for all my database
I am primarily a .NET developer, and in that sphere alone there are at
As a .NET developer I'm asking whether JBoss alternatives exist to be more suitable
I am a .Net developer that has been tasked with upgrading a classic asp
I'm a .Net developer and want to get into developing Silverlight applications. I have
I am a .NET developer now and have come from Foxpro /VB6/COM background. Over
I am ASP.NET developer from last 5 years and still loving it. There are
I have been a .net developer for the past three yrs. Just curious to

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.