Dictionary myDict = new Dictionary();
//...
foreach (KeyValuePair kvp in myDict)
{
kvp.Value = Math.Round(kvp.Value,
According to MSDN:
The foreach statement is a wrapper around the enumerator, which allows only reading from the collection, not writing to it.
Use this:
var dictionary = new Dictionary();
// TODO Populate your dictionary here
var keys = new List(dictionary.Keys);
foreach (string key in keys)
{
dictionary[key] = Math.Round(dictionary[key], 3);
}