CollectionExtensionsAsThreadSafeT Method
Returns a
LockingCollectionT, which provides a thread-safe wrapper for the specified
collection.
This only means that if the members are accessed through the returned
LockingCollectionT, then the inner state of the wrapped collection remains always consistent and not that all the multi-threading concerns can be ignored.
See the
Remarks section of the
LockingCollectionT class for details and some examples.
Namespace: KGySoft.CoreLibrariesAssembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 9.0.0
public static LockingCollection<T> AsThreadSafe<T>(
this ICollection<T> collection
)
<ExtensionAttribute>
Public Shared Function AsThreadSafe(Of T) (
collection As ICollection(Of T)
) As LockingCollection(Of T)
public:
[ExtensionAttribute]
generic<typename T>
static LockingCollection<T>^ AsThreadSafe(
ICollection<T>^ collection
)
[<ExtensionAttribute>]
static member AsThreadSafe :
collection : ICollection<'T> -> LockingCollection<'T>
- collection ICollectionT
- The collection to create a thread-safe wrapper for.
- T
- The type of the elements in the collection.
LockingCollectionTA
LockingCollectionT, which provides a thread-safe wrapper for the specified
collection.In Visual Basic and C#, you can call this method as an instance method on any object of type
ICollectionT. 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).