DictionaryExtensionsAsThreadSafeTKey, TValue Method
Returns a
LockingDictionaryTKey, TValue, which provides a thread-safe wrapper for the specified
dictionary.
This only means that if the members are accessed through the returned
LockingDictionaryTKey, TValue, then the inner state of the wrapped dictionary remains always consistent and not that all the multi-threading concerns can be ignored.
See the
Remarks section of the
LockingDictionaryTKey, TValue class for details and some examples.
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 10.0.0
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>
- dictionary IDictionaryTKey, TValue
- The dictionary to create a thread-safe wrapper for.
- TKey
- The type of the keys in the dictionary.
- TValue
- The type of the values in the dictionary.
LockingDictionaryTKey,
TValueA
LockingDictionaryTKey, TValue, which provides a thread-safe wrapper for the specified
dictionary.In Visual Basic and C#, you can call this method as an instance method on any object of type
IDictionaryTKey,
TValue. When you use instance method syntax to call this method, omit the first parameter. For more information, see
Extension Methods (Visual Basic) or
Extension Methods (C# Programming Guide).