/// <summary> /// 移除元素 /// 如果元素不存在而返回false /// </summary> /// <param name="socketAsync">元素</param> /// <returns></returns> internal bool Remove(SocketAsync <T> socketAsync) { if (socketAsync == null) { return(false); } var key = socketAsync.GetHashCode(); return(this.dic.TryRemove(key, out socketAsync)); }
/// <summary> /// 添加元素 /// 如果已包含此元素则返回false,同时不会增加记录 /// </summary> /// <param name="socketAsync">元素</param> /// <returns></returns> internal bool Add(SocketAsync <T> socketAsync) { if (socketAsync == null) { return(false); } var key = socketAsync.GetHashCode(); return(dic.TryAdd(key, socketAsync)); }