I have a list of object that has two properties, let's say a and b. a is an Enum like:
first=1[Flags] enum MyEnum { first = 1, second = 2, third = 4, forth fourth = 8,... }; I don't know how is it called in english... if anyone can edit that it would be great. b is an unsigned integer, which is a mask (combination of the MyEnum flags).
now i need to sum every object by their a - meaning an object can be summed twice if obj.a = first | third and i can't seem to do a groupBy to them. is there a different way to sum them?
I'm sorry i don't share my code, but i can't. i can tell you i did it using foreach in just some if - else blocks but i think i should learn how to do it in Linq
EDIT: I think i wasn't clear. i want to sum the object by the Enum, meaning if i have:
obj1.a = first, obj1.b = 5 obj2.a = first | second, obj2.b = 3 then the output will be
first sum = 8 second sum = 3