Zweidimensionales Array gruppieren und summieren

  • Thread starter Thread starter Mark Ancher
  • Start date Start date
M

Mark Ancher

Hallo,

Hat jemand eine Idee, wie ich ein Array der wie folgt definiert wurde:

object [,] dataObj;
DataObj = new object[5,3];


q w 2
w z 5
w z 4
m d 2
q w 4

performant gruppieren und summieren kann, so dass ich als Ergebnis

q w 6
w z 9
m d 2


bekomme?
Grüsse
Mark
 
Mark said:
Hallo,

Hat jemand eine Idee, wie ich ein Array der wie folgt definiert wurde:

object [,] dataObj;
DataObj = new object[5,3];


q w 2
w z 5
w z 4
m d 2
q w 4

performant gruppieren und summieren kann, so dass ich als Ergebnis

q w 6
w z 9
m d 2


bekomme?
Grüsse
Mark

Create a key from the two first values and use that to put the third
value in a dictionary. If the key already exists in the dictionary, add
the value instead.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top