var sessionId = a.Session.SessionID.ToString(); userDic.AddOrUpdate( authUser.UserId, sessionId, (key, oldValue) => sessionId);
static class ExtensionMethods { // Either Add or overwrite public static void AddOrUpdate<K, V>(this ConcurrentDictionary<K, V> dictionary, K key, V value) { dictionary.AddOrUpdate(key, value, (oldkey, oldvalue) => value); } }
userDic[authUser.UserId] = sessionId;