I am trying to use the AddOrUpdate() method in the ConcurrentDictionary class. I am having trouble with the Update peice. The following is the code:
dictionary.AddOrUpdate(oid, pList, (o,p) =>
{
for (int i=0; i < p.Count; i++)
p[i] = pList[i];
return p;
});
I would like to update the 3 values contained in a pList object when/if I hit the dictionary with a key that is already present. At the moment, only the very last for iteration ( p[2]) is being updated in the dictionary. What am I missing?