There is no reason to use LINQ here.
Assuming your dictionary Dictionary<int,int>, you can just do myDictionary[person.PersonID]++;.
You must use ContainsKeyit first to make sure the key exists in the dictionary, otherwise it will throw an exception if you try to change a dictionary entry that does not exist.
source
share