Код: Выделить всё
static void Main(string[] args)
{
var t = new ConcurrentDictionary();
t.AddOrUpdate("boo", null, (k, v) => null);
}
Код: Выделить всё
System.ArgumentNullException was unhandled
HResult=-2147467261
Message=Value cannot be null.
Parameter name: addValueFactory
ParamName=addValueFactory
Source=mscorlib
StackTrace:
at System.Collections.Concurrent.ConcurrentDictionary`2.AddOrUpdate(TKey key, Func`2 addValueFactory, Func`3 updateValueFactory)
at ConcurrentDictionaryTest.Program.Main(String[] args)
Код: Выделить всё
static void Main(string[] args)
{
var t = new ConcurrentDictionary();
const object defaultValue = null;
t.AddOrUpdate("boo", defaultValue, (k, v) => defaultValue);
}
Подробнее здесь: https://stackoverflow.com/questions/413 ... ddorupdate