ConcurrentDictionary, :
dictionary.AddOrUpdate(foo.Id, foo, (id, existing) =>
existing.UpdatedOn < foo.UpdatedOn ? foo : existing);
, . MSDN , , , :
, , GetOrAdd, , valueFactory.
, , , , . AddOrUpdate . :
do {
while (!TryGetValue(key, out value))
if (TryAdd(key, addValue)) return;
newValue = updateValueFactory(key, value);
} while (TryUpdate(key, newValue, value));
TryUpdate , , , , . , , TryGetValue , factory ..
, , factory , .