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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T22:31:30+00:00 2026-06-11T22:31:30+00:00

Down Below I took part of a code I was looking at. I don’t

  • 0

Down Below I took part of a code I was looking at. I don’t understand the IEnumerable part of the Code. Can someone just walk me through the meaning of each line. Thanks

I don’t understand the Where(u =>) more than the rest.

  public static List<AAlexUsers.Models.SearchClass> Users(string userId, string email, string lastFourdigits)   
    {
        SearchClass Alex = new SearchClass();
        Alex.userId = "1234";
        Alex.email = "Alex@gmail.com";
        Alex.lastFourdigits = "1885";

        SearchClass Emilio = new SearchClass();
        Emilio.userId = "0928";
        Emilio.email = "Cubano@gmail.com";
        Emilio.lastFourdigits = "0706";

        SearchClass Ulysses = new SearchClass();
        Ulysses.userId = "0914";
        Ulysses.email = "lysses@gmail.com";
        Ulysses.lastFourdigits = "01zx";

        var list = new List<SearchClass>();
        list.Add(Alex);
        list.Add(Emilio);
        list.Add(Ulysses);

        IEnumerable<SearchClass> result = list;
         if (!string.IsNullOrEmpty(userId))
            result = result.Where(u => u.userId == userId);
        if (!string.IsNullOrEmpty(email))
            result = result.Where(u => u.email == email);
        if (!string.IsNullOrEmpty(lastFourdigits))
            result = result.Where(u => u.lastFourdigits == lastFourdigits);


        return list.ToList();

    }
  • 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-11T22:31:31+00:00Added an answer on June 11, 2026 at 10:31 pm

    The IEnumerable is a collection of SearchClass objects. See it as something like a list or an array.

    IEnumerable is a generic interface describing something that can be enumerated (you can iterate through it and see/retrieve all of its elements). The content of this IEnumerable can have been pre-generated, or is live/lazily generated when you try to iterate through ‘result’ (IEnumerable).

    The next lines are queries run against this “result’ list:

    result = result.Where(u => u.userId == userId);
    

    can be confusing since it assigns the return of the query to the data the query is run on.
    Let’s take a simpler example:

    var myResult= myEnumerableList.Where(u => u.userId == "Yusuf");
    

    means that “var myResult” contains all elements from myEnumerableList, only when this element (here, called ‘u’)has a property userId that is equal to “Yusuf”

    .Net provides powerful ways to query collections/lists/anything_enumerable, presented with an SQL-like syntax

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

Sidebar

Related Questions

New programmer here, I am trying to understand and break down this code below
Below is a cut down example of some c# code I can't get to
Ok, i followed this tutorial (code is down below on the page, just top
I get the following error when I try and execute the code down below.
I'm trying to create a custom drop down and using the code below it
using the code down below to loop out 200 buttons and wnat the row
I'm trying to convert the string to int with stringstream, the code down below
I have two questions, I took the below code from a tutorial website in
the code down below delete all files inside a folder called Images . No
The code down below delete files inside the folder Images every 60 seconds, it

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.