Dictionary<string,double> myDict = new Dictionary();
//...
foreach (KeyValuePair<string,double> kvp in myDict)
{
kvp.Value = Math.Round(kvp.Value, 3);
}
我收到一个错误:
"无法将属性或索引器‘System.Collections.Generic.KeyValuePair.Value’分配给--它是只读的."
如何遍历myDict
并更改值?