forked from meebey/SmartIrc4net
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathConcurrentDictionaryEx.cs
43 lines (41 loc) · 1.74 KB
/
ConcurrentDictionaryEx.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/*
* SmartIrc4net - the IRC library for .NET/C# <http://smartirc4net.sf.net>
*
* Copyright (c) 2015 Katy Coe <[email protected]> <http://www.djkaty.com>
*
* Full LGPL License: <http://www.gnu.org/licenses/lgpl.txt>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
*/
using System.Collections.Concurrent;
using System.Collections.Generic;
namespace Meebey.SmartIrc4net
{
/// <summary>
/// Convenience extension methods to System.Collections.Concurrent.ConcurrentDictionary
/// </summary>
internal static class ConcurrentDictionaryEx
{
/// <summary>
/// Remove an item
/// </summary>
/// <typeparam name="TKey">Key type</typeparam>
/// <typeparam name="TValue">Value type</typeparam>
/// <param name="self">Dictionary to use</param>
/// <param name="key">Key of item to remove</param>
/// <returns>True on success, false on failure</returns>
public static bool Remove<TKey, TValue>(this ConcurrentDictionary<TKey, TValue> self, TKey key) => ((IDictionary<TKey, TValue>)self).Remove(key);
}
}