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 of the multi-threading concerns can be ignored.
See the Remarks section of the LockingCollectionT class for details and some examples.

Definition

Namespace: KGySoft.CoreLibraries
Assembly: KGySoft.CoreLibraries (in KGySoft.CoreLibraries.dll) Version: 8.1.0
C#
public static LockingCollection<T> AsThreadSafe<T>(
	this ICollection<T> collection
)

Parameters

collection  ICollectionT
The collection to create a thread-safe wrapper for.

Type Parameters

T
The type of the elements in the collection.

Return Value

LockingCollectionT
A LockingCollectionT, which provides a thread-safe wrapper for the specified collection.

Usage Note

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).

See Also