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

  • Home
  • SEARCH
  • 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 570749
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T13:26:06+00:00 2026-05-13T13:26:06+00:00

C# 2 and VB.Net 8 introduced a new feature called iterators , which were

  • 0

C# 2 and VB.Net 8 introduced a new feature called iterators, which were designed to make it easier to return enumerables and enumerators.

However, iterators are actually a limited form of coroutines, and can be used to do many useful things that have nothing to do with collections of objects.

What non-standard uses of iterators have you seen in real code?

  • 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-13T13:26:06+00:00Added an answer on May 13, 2026 at 1:26 pm

    I used them to write a system in ASP.NET for creating a series of linked page interactions. If you imagine a user’s conversation with a website as a series of requests and responses, you can model an interaction as an IEnumerable. Conceptually, like this;

    IEnumerable<PageResponse> SignupProcess(FormValues form)
    {
       // signup starts with a welcome page, asking
       // the user to accept the license.
       yield return new WelcomePageResponse();
    
       // if they don't accept the terms, direct 
       // them to a 'thanks anyway' screen
       if (!form["userAcceptsTerms"])
       {
          yield return new ThanksForYourTimePageResponse();
          yield break;
       }
    
       // On the second page, we gather their email;
       yield new EmailCapturePage("");
       while(!IsValid(form["address"]))
       {
         // loop until we get a valid address.
         yield return new EmailCapturePage("The email address is incorrect. Please fix.");
       } 
    }
    

    You can store the iterator in session state, so that when the user returns to the site you just pull the iterator out, move the iterator onto the next page, and yield it back for rendering. Complex site interactions are coded in a single place.

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

Sidebar

Related Questions

.NET 4 introduced Code Contracts as a new feature. I'd like to use CC,
Lifemojo.com has introduced a new feature through which you can access the calorie content
Microsoft introduced a new System.IO.MemoryMappedFiles namespace in .Net 4. Does anyone know if it
In ASP.NET MVC 2, a couple of new action filter attributes were introduced, as
A useful convenience introduced in .NET 4 is Stream.CopyTo(Stream[, Int32]) which reads the content
Why was Func<T, TResult>(..) introduced with .NET 3.0 whereas Action<T>(..) with .NET 2.0? Edit:
.Net contains a nice control called DocumentViewer . it also offers a subcontrol for
I am considering building some services using the new Web API that's introduced in
ASP.NET MVC4 Beta introduced an easy way to create OData endpoints using WebAPI. So
I'm new to developing web apps using ASP.NET MVC. In fact, I'm rather new

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.