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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 20, 20262026-05-20T13:58:08+00:00 2026-05-20T13:58:08+00:00

Basically I want to know if the two statements below are ultimately exactly the

  • 0

Basically I want to know if the two statements below are ultimately exactly the same. The NerdDinner tutorial states that IQueryable<> objects won’t query the database until we attempt to access/iterate over the data or call ToList on it. So aside from returning the same exact items do the two statements below also PERFORM the same as far as querying the database is concerned? If I had a million records, would one be better than the other?

I have the following statement:

    return from party in entities.Parties
           where party.PartyDate > DateTime.Now
           orderby party.PartyDate
           select party;

is that the same as:

    return entities.Parties.Where(p => p.PartyDate > DateTime.Now);
  • 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-20T13:58:09+00:00Added an answer on May 20, 2026 at 1:58 pm

    They will perform exactly the same, yes – aside from the ordering. With a very slight change, they will compile into exactly the same code:

    // Extension method syntax
    return from party in entities.Parties
           where party.PartyDate > DateTime.Now
           orderby party.PartyDate
           select party;
    
    // Query expression
    return entities.Parties
                   .Where(party => party.PartyDate > DateTime.Now)
                   .OrderBy(party => party.PartyDate);
    

    Note that as well as adding the OrderBy, I’ve also changed the name of the lambda expression parameter name to match that in the query expression.

    Effectively the compiler transforms the first block into the second block before applying all the normal compilation steps. You can think of query expression support as being a bit like a preprocessor step.

    I wrote about this in more detail in my Edulinq blog series, in Part 41: How Query Expressions Work.

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

Sidebar

Related Questions

Basically, I want to do two things: I want to know if there is
Given below are two PHP functions which basically does the same thing, What i
Basically I want to know how to set center alignment for a cell using
Basically, I want to know what is best to avoid future problems and confusions
Basically, I just want to know if its possible to use Nhibernate to migrate
I basically want to be able to deploy multiple versions of the same EAR
I want to make two prepared statements, one right after the other in PHP
OK I'm confused as how these two encryption methods work. I know that symmetric
Bascially I want to know the best way to hide/show an ASP.NET control from
I basically want to use link_to to link to the index method of a

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.