c# - Linq Query with SUM and ORDER BY -


One item is a (C #) square called hit with id id and a property property. I

I leave the remaining details to keep this balance. Now in my code, I have a large list, which I need to do the following selection (in a new list): I need to get a score of every hit. Score is for each individual hit. IitemID is sorted by the score, so if I have the following items in the original list

ItemID = 3, score = 5 item id = 1, score = 5 item id = 2, score = 5 item id = 3, score = 1 item id id = 1, score = 8 item id = 2, score = 10

The resulting list should contain the following:

  ItemID = 2, score = 15 itemID = 1, score = 13 item id = 3, score = 6  

Can someone help?

  var q = (h from hit group h in new {h.ItemID} hh Select new {hh.Key.ItemID, score = hh.Sum (s => score)}). Orderbinding sensing (i => i.Score);  

Comments

Popular posts from this blog

python - Overriding the save method in Django ModelForm -

html - CSS autoheight, but fit content to height of div -

qt - How to prevent QAudioInput from automatically boosting the master volume to 100%? -