Existing code is a completely suitable way to reduce all values ββin a dictionary.
If you want to create a new dictionary, you can use LINQ:
EPCs = EPCs.ToDictionary(p => p.Key, p => p.Value - 1);
This, however, will create an entirely new instance of Dictionary<string, int> instead of modifying the existing instance in place. However, since you tagged your question with linq , I decided that I was suggesting one of the ways (what I know) where LINQ can solve your problem.
source share