public static LockingDictionary<TKey, TValue> AsThreadSafe<TKey, TValue>(
this IDictionary<TKey, TValue> dictionary
)
<ExtensionAttribute>
Public Shared Function AsThreadSafe(Of TKey, TValue) (
dictionary As IDictionary(Of TKey, TValue)
) As LockingDictionary(Of TKey, TValue)
public:
[ExtensionAttribute]
generic<typename TKey, typename TValue>
static LockingDictionary<TKey, TValue>^ AsThreadSafe(
IDictionary<TKey, TValue>^ dictionary
)
[<ExtensionAttribute>]
static member AsThreadSafe :
dictionary : IDictionary<'TKey, 'TValue> -> LockingDictionary<'TKey, 'TValue>
To use a thread-safe dictionary without wrapping any IDictionaryTKey, TValue instance consider to use the ThreadSafeDictionaryTKey, TValue class instead.
For a CacheTKey, TValue instance consider to use the GetThreadSafeAccessor method instead, which does not necessarily lock the item loader delegate.