Quantcast
Channel: Recent Questions - Stack Overflow
Viewing all articles
Browse latest Browse all 11601

Sum Like Values in List

$
0
0

I have a list that contains a list of objects:

public QuestionScores {    public string QuestionReference { get; set; }    public int StudentScore { get; set: }    public int QuestionScore { get; set; }}

the list contains objects with the same Question Reference:

{ "U1C1", 1, 4 }{ "U1C1", 3, 4 }{ "U1C2", 2, 4 }

I want to end up with a list like this:

{ "U1C1", 4, 8 }{ "U1C2", 2, 4 }

I want to sum the StudentScore and QuestionScore into a single QuestionReference.Is this possible?


Viewing all articles
Browse latest Browse all 11601

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>