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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:53:55+00:00 2026-05-12T09:53:55+00:00

a month ago I asked this question: Trying to find the top 3 properties

  • 0

a month ago I asked this question: Trying to find the top 3 properties of a POCO instance. Got an answer, worked well.

Now, I’m trying to find the top 3 properties of a POCO object (like my previous question) but where each property has a WEIGHT. The value of the property comes first. The weight then comes in second … if two or more properties have the same value.

Lets expand on the data from my previous question as a starting point for an example :-

Lower the weight number the better. 1 == best. 10 is worst. Each weight number is UNIQUE btw. The weight number can be anything … i just need to somehow weight em….

eg.
Math (weight: 1) - 83%
Engrish (weight: 6) - 82%
Chemistry (weight: 2) - 81%
Drama (Weight: 3) - 100%
Geography (weight: 4) - 82%
Sport (Weight: 5)- 81%
etc..

Top 3 results, in order, are:

  • Drama
  • Math
  • Geography (not Engrish. Geography W = 4, Engrish W = 6)

I’m wondering if this can be achieved with Linq (like my previous question/answer). I’m happy with a dictionary, etc. I’m also guessing I might need to overload the Comparer method?

Cheers for any help 🙂

  • 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-12T09:53:56+00:00Added an answer on May 12, 2026 at 9:53 am

    Uhm. Based on your previous answer, and made up from me mind. (ie not tested)

    var result = (from p in pairs
                  orderby p.Value descending, p.Weight
                  select p);
    
    var result = pairs.OrderByDescending(p => p.Value)
                      .ThenBy(p => p.Weight);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I asked this question two months ago and got nary an answer. In fact
This is an interview question asked a month ago.... Do session use cookies? If
A month ago I asked this question . Even with a Bounty nobody came
I've asked one question about this a month ago, it's here: "post" method to
I don't know why, but this code worked for me a month ago... maybe
I know that question with same title has been asked almost 6 month ago.
It's almost a year ago that I asked this question on SO: Menu Accelerator
i'm already asked similar question month ago and dt recieve solution for my situation.
I asked similar question one month ago: Inheritance though composition? I took the examples
this question may have been asked many times, but could not find any suitable

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.