Concurrent翻译为并发,并行是Parallel,感谢叶伟民
大石头 authored at 2021-04-11 12:05:26
577.00 B
X
using System.Collections.Concurrent;

namespace System
{
    /// <summary>并发字典扩展</summary>
    public static class ConcurrentDictionaryExtensions
    {
        /// <summary>从并发字典中删除</summary>
        /// <typeparam name="TKey"></typeparam>
        /// <typeparam name="TValue"></typeparam>
        /// <param name="dict"></param>
        /// <param name="key"></param>
        /// <returns></returns>
        public static Boolean Remove<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> dict, TKey key) => dict.TryRemove(key, out _);
    }
}