ListCollectionT Class

A faster and functionally equivalent implementation of CollectionT

Definition

Namespace: Gemstone.Collections
Assembly: Gemstone.Common (in Gemstone.Common.dll) Version: 1.0.110 -- Release Build+3e0464f4461df4d3e1175b13966eb47ff832554d
Inheritance
Object    CollectionT    ListCollectionT
Implements
ICollectionT, IEnumerableT, IListT, IReadOnlyCollectionT, IReadOnlyListT, ICollection, IEnumerable, IList

Type Parameters

T
The type of the element in the collection

Remarks

CollectionT is based upon an IListT. This means any simple call to the class is a function call that cannot be in-lined. This implementation forces the underlying item to be ListT and shadows many of the methods to call ListT instead of IListT.

Since this class references the same underlying ListT object, it can be successfully implemented as a ListCollectionT or casted it its underlying type CollectionT.

Profiling this class yield a ForEach loop and For loop that executes between 2-4 times faster than CollectionT. This depends on the number of items in the list. The fewer the faster. Other operations such as Add/Insert/Remove are closer to 50% faster. Count is now in-lined (~20 times faster).

This performance is negated if accessing this class via the IList interface. When possible, use only strongly typed names.

Constructors

ListCollectionT Creates a ListCollectionT
ListCollectionT(ListT) Creates a ListCollectionT

Properties

Count Gets the number of elements contained in the ICollectionT.
Item Gets or sets the element at the specified index.
Items Gets a IListT wrapper around the CollectionT.

Methods

Add Adds an item to the ICollectionT.
Clear Removes all items from the ICollectionT.
ClearItems Removes all elements from the CollectionT.
(Overrides CollectionTClearItems)
Contains Determines whether the ICollectionT contains a specific value.
CopyTo Copies the elements of the ICollectionT to an Array, starting at a particular Array index.
EqualsDetermines whether the specified object is equal to the current object.
(Inherited from Object)
FinalizeAllows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object)
GetEnumerator Returns an enumerator that iterates through the CollectionT.
GetHashCodeServes as the default hash function.
(Inherited from Object)
GetTypeGets the Type of the current instance.
(Inherited from Object)
IndexOf Determines the index of a specific item in the IListT.
Insert Inserts an item to the IListT at the specified index.
InsertItem Inserts an element into the CollectionT at the specified index.
(Overrides CollectionTInsertItem(Int32, T))
MemberwiseCloneCreates a shallow copy of the current Object.
(Inherited from Object)
Remove Removes the first occurrence of a specific object from the ICollectionT.
RemoveAt Removes the element at the specified index of the CollectionT.
RemoveItem Removes the element at the specified index of the CollectionT.
(Overrides CollectionTRemoveItem(Int32))
SetItem Replaces the element at the specified index.
(Overrides CollectionTSetItem(Int32, T))
ToStringReturns a string that represents the current object.
(Inherited from Object)

Extension Methods

AddRangeT Adds the specified items to the collection.
(Defined by CollectionExtensions)
AllParallelT Determines whether all elements of a sequence satisfy a condition with each item being tested in parallel.
(Defined by CollectionExtensions)
DistinctByT, TKey Returns only the elements whose keys are distinct.
(Defined by CollectionExtensions)
GetEnumValueOrDefault Gets the enumeration constant for value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
GetEnumValueOrDefaultT Gets the enumeration constant for this value, if defined in the enumeration, or a default value.
(Defined by EnumExtensions)
GetRangeT Returns elements in the specified range from the collection.
(Defined by CollectionExtensions)
IndexOfT Returns the index of the first element of the sequence that satisfies a condition or -1 if no such element is found.
(Defined by CollectionExtensions)
LoadDelimitedStringTAppends items parsed from delimited string, created with ToDelimitedString, using the default delimiter ("|") into the given list.
(Defined by CollectionExtensions)
LoadDelimitedStringTAppends items parsed from delimited string, created with ToDelimitedString, into the given list.
(Defined by CollectionExtensions)
LoadDelimitedStringTAppends items parsed from delimited string, created with ToDelimitedString, into the given list.
(Defined by CollectionExtensions)
MajorityT Returns the majority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions)
MajorityT Returns the majority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions)
MajorityByT, TKey Returns the majority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions)
MajorityByT, TKey Returns the majority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions)
MaxTReturns the largest item from the enumeration.
(Defined by CollectionExtensions)
MaxTReturns the largest item from the enumeration.
(Defined by CollectionExtensions)
MaxByT, TKeySelects the largest item from the enumeration.
(Defined by CollectionExtensions)
MedianT Gets the median item(s) from an enumeration, i.e., one return item for odd lengths, two for even lengths.
(Defined by CollectionExtensions)
MinTReturns the smallest item from the enumeration.
(Defined by CollectionExtensions)
MinTReturns the smallest item from the enumeration.
(Defined by CollectionExtensions)
MinByT, TKeySelects the smallest item from the enumeration.
(Defined by CollectionExtensions)
MinorityT Returns the minority value in the collection, or default type value if no item represents the minority.
(Defined by CollectionExtensions)
MinorityT Returns the minority value in the collection, or defaultValue if no item represents the minority.
(Defined by CollectionExtensions)
MinorityByT, TKey Returns the minority value in the collection, or default type value if no item represents the majority.
(Defined by CollectionExtensions)
MinorityByT, TKey Returns the minority value in the collection, or defaultValue if no item represents the majority.
(Defined by CollectionExtensions)
ScrambleT Rearranges all the elements in the list into a highly-random order.
(Defined by CollectionExtensions)
ScrambleT Rearranges all the elements in the list into a repeatable pseudo-random order.
(Defined by CollectionExtensions)
ToDelimitedStringTConverts an enumeration to a string, using the default delimiter ("|") that can later be converted back to a list using LoadDelimitedString.
(Defined by CollectionExtensions)
ToDelimitedStringTConverts an enumeration to a string that can later be converted back to a list using LoadDelimitedString.
(Defined by CollectionExtensions)
ToDelimitedStringTConverts an enumeration to a string that can later be converted back to a list using LoadDelimitedString.
(Defined by CollectionExtensions)
ToPagedListT Gets a PagedListT to paginate source enumeration for a given page and specified pageSize.
(Defined by CollectionExtensions)
UnscrambleT Rearranges all the elements in the list previously scrambled with ScrambleTSource(IListTSource, Int32) back into their original order.
(Defined by CollectionExtensions)
UpdateRangeT Updates collection starting at the index with the specified items.
(Defined by CollectionExtensions)

See Also