Click or drag to resize

ConcurrentCollectionT Class

Represents a thread-safe, unordered collection of object.
Inheritance Hierarchy
SystemObject
  Cauldron.CollectionsConcurrentCollectionT

Namespace:  Cauldron.Collections
Assembly:  Cauldron.Collections (in Cauldron.Collections.dll) Version: 1.0.0
Syntax
public class ConcurrentCollection<T> : ICollection<T>, 
	IEnumerable<T>, IEnumerable, ICollection

Type Parameters

T
The type of the elements to be stored in the collection.

The ConcurrentCollectionT type exposes the following members.

Constructors
  NameDescription
Public methodConcurrentCollectionT
Initializes a new instance of ConcurrentCollectionT
Public methodConcurrentCollectionT(IEnumerableT)
Initializes a new instance of ConcurrentCollectionT.
Public methodConcurrentCollectionT(Int32)
Initializes a new instance of ConcurrentCollectionT
Top
Properties
  NameDescription
Public propertyCount
Gets the number of elements contained in the ConcurrentCollectionT.
Public propertyIsReadOnly
Gets a value indicating whether the ConcurrentCollectionT is read-only. This is always false.
Public propertyIsSynchronized
Gets a value indicating whether access to the ConcurrentCollectionT is synchronized (thread safe). This is always true.
Public propertySyncRoot
Gets an object that can be used to synchronize access to the ConcurrentCollectionT.
Top
Methods
  NameDescription
Public methodAdd
Adds an item to the ConcurrentCollectionT.
Public methodAddRange
Adds a collection of elements to the ConcurrentCollectionT.
Public methodClear
Removes all items from the ConcurrentCollectionT.
Public methodContains(T)
Determines whether the ConcurrentCollectionT contains a specific value. This is lock-free and can return true even though the element has already been removed.
Public methodContains(T, Boolean)
Determines whether the ConcurrentCollectionT contains a specific value.
Public methodGetEnumerator
Returns an enumerator that iterates through the ConcurrentCollectionT. The enumerator will iterate through a copy of the internal list. Changes in the collection during the iteration are ignored.
Protected methodOnClear
Occures if all elements of the ConcurrentCollectionT was removed.
Protected methodOnItemAdded
Occures if a new item was added to the ConcurrentCollectionT.
Protected methodOnItemsAdded
Occures if new items were added to the ConcurrentCollectionT.
Protected methodOnRemove(T)
Occures if an element was removed from the ConcurrentCollectionT.
Protected methodOnRemove(T)
Occures if elements were removed from the ConcurrentCollectionT.
Public methodRemove(FuncT, Boolean)
Removes all elements that matches the predicate from the ConcurrentCollectionT.
Public methodRemove(T)
Removes the first occurrence of a specific object from the ConcurrentCollectionT.
Top
Extension Methods
  NameDescription
Public Extension MethodAppendT
Concatenates an item into a sequences.
(Defined by Extensions.)
Public Extension MethodCode exampleAs(Type)Overloaded.
Converts a type using the implicit or explicit operators. If both fails it will try to convert the value with ChangeType(Object, Type).
(Defined by ExtensionsConvertions.)
Public Extension MethodCode exampleAs(Type, Type)Overloaded.
Converts a type using the implicit or explicit operators. If both fails it will try to convert the value with ChangeType(Object, Type).
(Defined by ExtensionsConvertions.)
Public Extension MethodCode exampleAsTOverloaded.
Performs a cast between compatible reference types. If a convertion is not possible then null is returned. As a last resort it will use ChangeType(Object, Type).

Tries to use the implicit and explicit operators if exists when convertion with 'as' returns null.

(Defined by ExtensionsConvertions.)
Public Extension MethodCode exampleCreateTypeT
Creates a new Type that implements the properties of an interface defined by T and copies all value of anon to the new object.
(Defined by ExtensionsInterception.)
Public Extension MethodDistinctT
Returns distinct elements from a sequence by using a selector to compare values.
(Defined by Extensions.)
Public Extension MethodForeachT (Defined by Extensions.)
Public Extension MethodGetPropertyNonPublicValueT
Searches for the specified property, using the specified binding constraints and returns its value.

Default BindingFlags are Instance and NonPublic

(Defined by ExtensionsReflection.)
Public Extension MethodGetPropertyValue(String, BindingFlags)Overloaded.
Searches for the specified property, using the specified binding constraints and returns its value.
(Defined by ExtensionsReflection.)
Public Extension MethodGetPropertyValueT(String)Overloaded.
Searches for the specified property, using the specified binding constraints and returns its value.

Default BindingFlags are Instance and Public

(Defined by ExtensionsReflection.)
Public Extension MethodGetPropertyValueT(String, BindingFlags)Overloaded.
Searches for the specified property, using the specified binding constraints and returns its value.
(Defined by ExtensionsReflection.)
Public Extension MethodInterleaveT
Interleve combine two collections.
(Defined by Extensions.)
Public Extension MethodJoinT
Concatenates the members of a collection, using the specified separator between each member.
(Defined by Extensions.)
Public Extension MethodMapToT
Maps all properties and fields of an instance to another instance. The Clone() method is used to copy an instance if exist.

Mapping fails on jagged and multidimensional array. Classes without parameterless constructor will stay null.

(Defined by ExtensionsCloning.)
Public Extension MethodMaxByT, TKey(FuncT, TKey)Overloaded.
Returns the item with the maximum value in a sequence of values.
(Defined by Extensions.)
Public Extension MethodMaxByT, TKey(FuncT, TKey, IComparerTKey)Overloaded.
Returns the item with the maximum value in a sequence of values.
(Defined by Extensions.)
Public Extension MethodMinByT, TKey(FuncT, TKey)Overloaded.
Returns the item with the minimum value in a sequence of values.
(Defined by Extensions.)
Public Extension MethodMinByT, TKey(FuncT, TKey, IComparerTKey)Overloaded.
Returns the item with the minimum value in a sequence of values.
(Defined by Extensions.)
Public Extension MethodOperations
Provides linq like methods for handling and converting IEnumerables.

This is separated from actual extension to avoid confusions with System.Linq extensions. And also to avoid accidental usage.

(Defined by Extensions.)
Public Extension MethodToArray
Converts a IEnumerable to an array
(Defined by ExtensionsConvertions.)
Public Extension MethodToLong
Tries to convert a Object to an Int64. Returns MinValue if target cannot be parsed.
(Defined by ExtensionsConvertions.)
Public Extension MethodToStringEx(String)Overloaded.
Converts the value of this instance to its equivalent string representation, using the specified format.

The following custom formatter are already added: ByteSizeFormatter, MetricUnitFormatter

(Defined by Extensions.)
Public Extension MethodToStringEx(String, CultureInfo)Overloaded.
Converts the value of this instance to its equivalent string representation, using the specified format.

The following custom formatter are already added: ByteSizeFormatter, MetricUnitFormatter

(Defined by Extensions.)
Public Extension MethodTryDispose
Tries to performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

This will dispose an object if it implements the IDisposable interface.

(Defined by Extensions.)
Top
Explicit Interface Implementations
  NameDescription
Explicit interface implementationPrivate methodIEnumerableGetEnumerator
Returns an enumerator that iterates through the ConcurrentCollectionT. The enumerator will iterate through a copy of the internal list. Changes in the collection during the iteration are ignored.
Top
See Also