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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T20:49:36+00:00 2026-05-29T20:49:36+00:00

When the priceList is small the query is executed quickly, but if the priceList

  • 0

When the priceList is small the query is executed quickly, but if the priceList has more than five elements the query is very slow.

if(!filters.Price.All && !filters.Price.IsEmpty())
{
    var priceList = filters.Price.GetRangeList();
    foreach (var price in priceList)
    {
        decimal startPrice = decimal.Parse(price[0]);
        decimal endPrice = decimal.Parse(price[1]);


        var priceResult = from deal in query
                          where (deal.DiscountPrice >= startPrice && deal.DiscountPrice <= endPrice)
                          select deal;
        if(priceResult.Count() != 0)
        priceResults = (priceResults == null) ? priceResult : priceResult.Union(priceResults);
    }


    query = query.Intersect(priceResults);
}
  • 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-29T20:49:37+00:00Added an answer on May 29, 2026 at 8:49 pm

    I may be misunderstanding your code, but as far as I can tell, the result of the Intersect operation will have same the list of objects as priceResults – hence the Intersect is completely unnecessary (so removing it will be quite an optimization). 🙂

    Unless the priceResults list has contents before entering this code block, it will only have objects from the query list, so finding the intersection between the two will always result in the priceResults list.

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

Sidebar

Related Questions

Which is more correct, PriceList or Pricelist? FxCop says: CA1702 : Microsoft.Naming : The
netbeans platform has proved to be most useful for large applications. But what about
I have an ASP.NET web page(Not MVC ) (HomePage.aspx) and another page (PRiceList.aspx).I have
For part of a site I'm working on, I am constructing a price list...
I have a picklist web interface: a pair of select elements with a pair
I am working on a price list management program for my business in C#
I have this java code: if(isNull(office) || isNull(pricelist)) { log.warn(The document {0}-{1} is not
I'm trying to create image from SQLite database in Java Swing application. But it
Im currently developing av price list using SQL Reporting Services. In that report I
I'm a newbie at C, in the early stages of building a small Scheme

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.