/// <summary> /// /// </summary> /// <param name="serial"></param> public void RemoveMany(IEnumerable <KeyT> key) { m_LockMultiDictionary.EnterWriteLock(); { m_MultiDictionary.RemoveMany(key); m_bIsValueChange = true; } m_LockMultiDictionary.ExitWriteLock(); }
/// <summary> ///RemoveMany 的测试 ///</summary> public void RemoveManyTestHelper <KeyT, ValueT>() { bool allowDuplicateValues = false; // TODO: 初始化为适当的值 MultiDictionary <KeyT, ValueT> target = new MultiDictionary <KeyT, ValueT>(allowDuplicateValues); // TODO: 初始化为适当的值 IEnumerable <KeyT> keyCollection = null; // TODO: 初始化为适当的值 int expected = 0; // TODO: 初始化为适当的值 int actual; actual = target.RemoveMany(keyCollection); Assert.AreEqual(expected, actual); Assert.Inconclusive("验证此测试方法的正确性。"); }
/// <summary> /// /// </summary> /// <param name="serial"></param> public void RemoveMany(KeyT key, IEnumerable <ValueT> values) { MultiDictionary <KeyT, ValueT> newMultiDict = null; MultiDictionary <KeyT, ValueT> oldMultiDict = null; do { oldMultiDict = m_MultiDictionary; newMultiDict = new MultiDictionary <KeyT, ValueT>(m_AllowDuplicateValues); foreach (var item in oldMultiDict) { newMultiDict.AddMany(item.Key, item.Value); } newMultiDict.RemoveMany(key, values); } while (Interlocked.CompareExchange <MultiDictionary <KeyT, ValueT> >(ref m_MultiDictionary, newMultiDict, oldMultiDict) != oldMultiDict); }