I'm trying to get a linq query running which I can't get right.
I have a list of a custom class called Occurrences, this class has two properties Code as String and Negative as Boolean. I am trying to get the net total of Code (group by Code) so this would be a count of Code where Negative = False (All positive), subtract a count of Code where Negative = True (All negative). There is no quantity in the Occurrences class, each occurrence counts as 1 negative or positive.
I tried to do this in 3 separate queries which did not work, ideally I would like to do this in 1 query.
Please let me know if you need a better explanation or if I am unclear.
Edit: Sample input/output
Any help on above is really appreciated.