Decrement all int values in Dictionary

Posted by Jon on Stack Overflow See other posts from Stack Overflow or by Jon
Published on 2010-05-10T15:05:31Z Indexed on 2010/05/10 15:14 UTC
Read the original article Hit count: 149

Filed under:
|
|
|
|

I have a Dictionary<string,int> and I simply want to decrement the value in my dictionary by one.

I have this but not sure if its best practice.

foreach (KeyValuePair<string, int> i in EPCs)
{
   EPCs[i.Key] = i.Value - 1;
}

© Stack Overflow or respective owner

Related posts about c#

Related posts about LINQ