Maybe you could help me out with this if i give you some more details about my SumX class.

It contains 2 important (key) properties, CodeXX (product code, actual collection key) and ColorXX (product color - needs to be a second key), and TotalXX -plain amount sum holder.

In this code i process one by one object(CodeXX) to find out an amount of products (TotalXX) in certain color (ColorXX) (in all sizes together)

In my If statement i check if some product has a record (Color) already existing in a table. If not, the code puts a new record in the table, and creates a new SumX object by adding product code in its CodeXX property, product color in ColorXX, and its amount (in certain size) in TotalXX property.

But if this color (of the same product) already exists in the table, it should just update (increment) the TotalXX property of the object.

So the problem is, if some color doesn't exist in the table, its (corresponding) object needs to be created, but it is possible only for first object, any subsequent one encounters existing CodeXX key, which belongs to the first object /color/.

Thus i need some kind of 'second key' for ColorXX property.

I think of using 3dimensional array, but i need to call its elements by string value, not indexes.

Also i don't know how could i use concatenation of these 2 keys (how and when to merge and unmerge?)


If someone has an idea about this issue, it would be greatly appreciated.