https://msdn.microsoft.com/zh-cn/library/ee378665(v=vs.110).aspx
此方法有一共有2个,现在只讨论其中一个
public TValue AddOrUpdate(
TKey key,
TValue addValue,
Func<TKey, TValue, TValue> updateValueFactory
)
Parameters 参数说明
key 参数名称 【此参数不允许为null】
Type: TKey 参数类型
The key to be added or whose value should be updated 需要添加或者更新的key
addValue 参数名称
Type: TValue 参数类型
The value to be added for an absent key 和新key匹配的value
updateValueFactory 参数名称 【此参数不允许为null】
Type: System.Func<TKey, TValue, TValue> 参数类型
The function used to generate a new value for an existing key based on the key's existing value 此函数用来基于已有的key的value来生成新的值
Return Value 返回值
Type: TValue 返回值的类型
The new value for the key. This will be either be addValue (if the key was absent) or the result of updateValueFactory (