In a Dictionary<struct,int>: is it possible to Add/Set in one call?
So is it possible to do the code below in only one lookup per entry?
_KeyToPoints = new Dictionary<Key,int>();
foreach ( var entry in billionEntries )
{
int originalValue;
// first lookup
_KeyToPoints.TryGetValue(entry.Key, out originalValue);
// second lookup
_KeyToPoints[key] = originalValue + points;
}
This is done in a very tight loop over a huge amount of data, so all performance matters.
Or is there a better suitable data structure?