出现这样的错误: 无法修改“System.Collections.Generic.Dictionary.this[string]”的返回值,因为它不是一个变量。
我的代码:
Dictionary<string, lim> urlsLimited = new Dictionary<string, lim>();
struct lim
{
public int min;
public int max;
}
void main ()
{
....
foreach (KeyValuePair<string, lim> pair in urlsLimited)
{
string like = od.LikeDiscussions(pair.Key);
if (like == "Like")
{
lock (locker)
{
urlsLimited[pair.Key].min++; // error
}
}
}
....
}
如何迭代 urlsLimited [pair.Key] .min++?