Resharper 抛出此检查问题:
添加到集合之前的冗余字典“ContainsKey”
在这部分代码:
var userPref = new Preferences { Key = key, Value = value };
if (this.preferencesDictionary.ContainsKey(key))
{
this.preferencesDictionary[key] = userPref;
}
else
{
this.preferencesDictionary.Add(key, userPref);
}
return this;
我真的不认为这是多余的。这是一个我应该跳过的错误?或者说这里真的有改进吗?