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 🙂
Uhm. Based on your previous answer, and made up from me mind. (ie not tested)