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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 18, 20262026-05-18T02:14:32+00:00 2026-05-18T02:14:32+00:00

Can you help me to understand, words.Aggregate((workingSentence, next) => + next + + workingSentence);

  • 0

Can you help me to understand,

       words.Aggregate((workingSentence, next) => + next + " " + workingSentence);   

from below code snippet? and it would be great if someone explain me to achive this in C# 1.1.

(Snippet From MS)-

        string sentence = "the quick brown fox jumps over the lazy dog";
        // Split the string into individual words.
        string[] words = sentence.Split(' ');
        // Prepend each word to the beginning of the 
        // new sentence to reverse the word order.
        string reversed = words.Aggregate((workingSentence, next) =>
                                              next + " " + workingSentence);
        Console.WriteLine(reversed);
        // This code produces the following output:
        //
        // dog lazy the over jumps fox brown quick the
  • 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-18T02:14:33+00:00Added an answer on May 18, 2026 at 2:14 am

    The Aggregate part of your example translates to something roughly like this:

    string workingSentence = null;
    bool firstElement = true;
    foreach (string next in words)
    {
        if (firstElement)
        {
            workingSentence = next;
            firstElement = false;
        }
        else
        {
            workingSentence = next + " " + workingSentence;
        }
    }
    string reversed = workingSentence;
    

    The workingSentence variable is an accumulator that is updated on each iteration of the loop by applying a function to the existing accumulator value and the current element of the sequence; this is performed by the lambda in your example and by the body of the foreach loop in my example.

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

Sidebar

Related Questions

(Specifically, I'm using Backbone Model events) Can someone help me understand how javascript events
Can someone help me understand how OpenID works? I'm interested in the following answers:
Can you help me understand the practical differences between these two; IList<int> myList =
I wonder if anyone can help me to understand where I could be going
I'm a student looking for resources which can help me further understand how to
Can you help me to understand, how do I do Drupal website deployment and
Can anyone please help me to understand how should i access json data in
Please help me. I can't understand why this function, that uses texture memory __global__
If there is anyone that can help me understand why this git repo isn't
Here is the code that will help you understand my question: create table con

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.