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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 10, 20262026-05-10T14:28:54+00:00 2026-05-10T14:28:54+00:00

Speaking as a non-C# savvy programmer, I’m curious as to the evaluation semantics of

  • 0

Speaking as a non-C# savvy programmer, I’m curious as to the evaluation semantics of LINQ queries like the following:

var people = from p in Person              where p.age < 18              select p  var otherPeople = from p in people                   where p.firstName equals 'Daniel'                   select p 

Assuming that Person is an ADO entity which defines the age and firstName fields, what would this do from a database standpoint? Specifically, would the people query be run to produce an in-memory structure, which would then be queried by the otherPeople query? Or would the construction of otherPeople merely pull the data regarding the query from people and then produce a new database-peered query? So, if I iterated over both of these queries, how many SQL statements would be executed?

  • 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. 2026-05-10T14:28:55+00:00Added an answer on May 10, 2026 at 2:28 pm

    They are composable. This is possible because LINQ queries are actually expressions (code as data), which LINQ providers like LINQ-to-SQL can evaluate and generate corresponding SQL.

    Because LINQ queries are lazily evaluated (e.g. won’t get executed until you iterate over the elements), the code you showed won’t actually touch the database. Not until you iterate over otherPeople or people will SQL get generated and executed.

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

Sidebar

Related Questions

Is there anything speaking against a structure like to following. In Release mode, Visual
Generally speaking, a common VB.NET class should look like the following: Public Class MyClassName
I have often wondered why it is that non-English speaking programmers are forced to
I'm speaking of this module: http://docs.python.org/library/operator.html From the article: The operator module exports a
I was wondering whether the majority of non English speaking cultures, especially in Europe,
I am creating a service that could go international to non-English speaking markets. I
Possible Duplicate: Why C# implements methods as non-virtual by default? I'm speaking primarily about
I'm not sure if this is possible (complete non-flash developer speaking), but we have
Generally speaking, I'm a decent programmer, (C++, Java, Ruby, Python) but I at the
Architecturally speaking how could you consolidate data coming from multiple OData / WCF services

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.