public MessageQueueItem Add(string key, Action action) { lock (MessageQueueSyncLock) { var mqItem = new MessageQueueItem(key, action); MessageQueueDictionary.TryAdd(key, mqItem); return(mqItem); } }
public bool Remove(string key, out MessageQueueItem value) { lock (MessageQueueSyncLock) { if (MessageQueueDictionary.ContainsKey(key)) { return(MessageQueueDictionary.TryRemove(key, out value)); } else { value = null; return(true); } } }