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 8119803
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 6, 20262026-06-06T04:54:58+00:00 2026-06-06T04:54:58+00:00

Looking at some of the code System.Linq I’ve come across some examples of Buffer<TSource>

  • 0

Looking at some of the code System.Linq I’ve come across some examples of Buffer<TSource> being used.

In the example of Enumemerable.ReverseIterator what is the benefit of using a Buffer?

private static IEnumerable<TSource> ReverseIterator<TSource>(
                                                        IEnumerable<TSource> source)
    {
      Buffer<TSource> buffer = new Buffer<TSource>(source);
      for (int i = buffer.count - 1; i >= 0; --i)
        yield return buffer.items[i];
    }
  • 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-06-06T04:55:00+00:00Added an answer on June 6, 2026 at 4:55 am

    Well something needs to read the entirety of the sequence, so that it can then return them in the reverse order. Buffer<TSource> is one option here, and an efficient one – but it could be implemented with ToArray() or ToList(). A buffer allows an “oversized” array to be created (in the same way as it would for a list, but with less versioning etc) without the final “trim” step which would be present in ToArray.

    You might find some of my Edulinq (my reimplementation of LINQ to Objects for fun and education) articles interesting, including:

    • ToArray
    • Part of implementing ordering
    • Reverse

    (Deliberately in that order, as they show an evolution leading towards a similar “buffer” idea.)

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

Sidebar

Related Questions

I'm looking at some code that uses the .NET System.Configuration.SettingsProvider and ApplicationSettingsBase to handle
I have some code looking like this: using System.Threading; public sealed class MyClass :
I'm looking for some good code examples of dynamic memory allocation using an assembly
I'm looking for some code to check if a file in the file system
I'm looking for some code to check if a file in the file system
Looking at some code I'm maintaining in System Verilog I see some signals that
In looking at System.Linq.Enumerable through Reflector i noticed that default iterator used for Select
Alright...I am here looking for some bread crumbs. This is my code: using System;
I'm looking for some code (C# or VB.NET preferred) to iterate through all folders
I'm looking at some code which should be trivial -- but my math is

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.