Wintellect.PowerCollections Namespace

Classes

 | Class | Description
Public class | Algorithms | Algorithms contains a number of static methods that implement algorithms that work on collections. Most of the methods deal with the standard generic collection interfaces such as IEnumerable<T>, ICollection<T> and IList<T>.
Public class | Bag<(Of <(<'T>)>)> | Bag<T> is a collection that contains items of type T. Unlike a Set, duplicate items (items that compare equal to each other) are allowed in an Bag.
Public class | BigList<(Of <(<'T>)>)> | BigList<T> provides a list of items, in order, with indices of the items ranging from 0 to one less than the count of items in the collection. BigList<T> is optimized for efficient operations on large (>100 items) lists, especially for insertions, deletions, copies, and concatinations.
Public class | CollectionBase<(Of <(<'T>)>)> | CollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces.
Public class | Deque<(Of <(<'T>)>)> | The Deque class implements a type of list known as a Double Ended Queue. A Deque is quite similar to a List, in that items have indices (starting at 0), and the item at any index can be efficiently retrieved. The difference between a List and a Deque lies in the efficiency of inserting elements at the beginning. In a List, items can be efficiently added to the end, but inserting an item at the beginning of the List is slow, taking time proportional to the size of the List. In a Deque, items can be added to the beginning or end equally efficiently, regardless of the number of items in the Deque. As a trade-off for this increased flexibility, Deque is somewhat slower than List (but still constant time) when being indexed to get or retrieve elements.
Public class | DictionaryBase<(Of <(<'TKey, TValue>)>)> | DictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.
Public class | ListBase<(Of <(<'T>)>)> | ListBase is an abstract class that can be used as a base class for a read-write collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase.
Public class | MultiDictionary<(Of <(<'TKey, TValue>)>)> | The MultiDictionary class that associates values with a key. Unlike an Dictionary, each key can have multiple values associated with it. When indexing an MultiDictionary, instead of a single value associated with a key, you retrieve an enumeration of values. When constructed, you can chose to allow the same value to be associated with a key multiple times, or only one time.
Public class | MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> | MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface.
Public class | OrderedBag<(Of <(<'T>)>)> | OrderedBag<T> is a collection that contains items of type T. The item are maintained in a sorted order. Unlike a OrderedSet, duplicate items (items that compare equal to each other) are allows in an OrderedBag.
Public class | OrderedBag<(Of <(<'T>)>)>..::..View | The OrderedBag<T>.View class is used to look at a subset of the items inside an ordered bag. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.
Public class | OrderedDictionary<(Of <(<'TKey, TValue>)>)> | OrderedDictionary<TKey, TValue> is a collection that maps keys of type TKey to values of type TValue. The keys are maintained in a sorted order, and at most one value is permitted for each key.
Public class | OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View | The OrderedDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.
Public class | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> | The OrderedMultiDictionary class that associates values with a key. Unlike an OrderedDictionary, each key can have multiple values associated with it. When indexing an OrderedMultidictionary, instead of a single value associated with a key, you retrieve an enumeration of values. All of the key are stored in sorted order. Also, the values associated with a given key are kept in sorted order as well. When constructed, you can chose to allow the same value to be associated with a key multiple times, or only one time.
Public class | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View | The OrderedMultiDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered multi-dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.
Public class | OrderedSet<(Of <(<'T>)>)> | OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth.
Public class | OrderedSet<(Of <(<'T>)>)>..::..View | The OrderedSet<T>.View class is used to look at a subset of the Items inside an ordered set. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.
Public class | ReadOnlyCollectionBase<(Of <(<'T>)>)> | ReadOnlyCollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces for a read-only collection: a collection that does not allow adding or removing elements.
Public class | ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> | ReadOnlyDictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.
Public class | ReadOnlyListBase<(Of <(<'T>)>)> | ReadOnlyListBase is an abstract class that can be used as a base class for a read-only collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the Count property and the get part of the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase.
Public class | ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> | MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface. The resulting collection is read-only -- items cannot be added or removed.
Public class | Set<(Of <(<'T>)>)> | Set<T> is a collection that contains items of type T. The item are maintained in a haphazard, unpredictable order, and duplicate items are not allowed.

Structures

 | Structure | Description
Public structure | Pair<(Of <(<'TFirst, TSecond>)>)> | Stores a pair of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary.
Public structure | Triple<(Of <(<'TFirst, TSecond, TThird>)>)> | Stores a triple of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary.

Delegates

 | Delegate | Description
Public delegate | BinaryPredicate<(Of <(<'T>)>)> | The BinaryPredicate delegate type encapsulates a method that takes two items of the same type, and returns a boolean value representating some relationship between them. For example, checking whether two items are equal or equivalent is one kind of binary predicate.
Help File generated with GhostDoc


Algorithms Class

Algorithms contains a number of static methods that implement algorithms that work on collections. Most of the methods deal with the standard generic collection interfaces such as IEnumerable<T>, ICollection<T> and IList<T>.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static class Algorithms
Public NotInheritable Class Algorithms
public ref class Algorithms abstract sealed

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..Algorithms

See Also

Algorithms Members
Wintellect.PowerCollections Namespace


Algorithms Members

The Algorithms type exposes the following members.

Methods

Name | Description
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the natural ordering of the type (it's implementation of IComparable<T>).
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IComparer<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed instance of IComparer<T>.
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Comparison<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed Comparison<T> delegate.
CartesianProduct<(Of <<'(TFirst, TSecond>)>>) | Computes the cartestian product of two collections: all possible pairs of items, with the first item taken from the first collection and the second item taken from the second collection. If the first collection has N items, and the second collection has M items, the cartesian product will have N * M pairs.
Concatenate<(Of <<'(T>)>>) | Concatenates all the items from several collections. The collections need not be of the same type, but must have the same item type.
Convert<(Of <<'(TSource, TDest>)>>) | Convert a collection of items by applying a delegate to each item in the collection. The resulting collection contains the result of applying converter to each item in sourceCollection, in order.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32) | Copies all of the items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32) | Copies all of the items from the collection source to the array dest, starting at the index destIndex.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32, Int32) | Copies at most count items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source collection must not be the destination list or part thereof.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32, Int32) | Copies at most count items from the collection source to the array dest, starting at the index destIndex. The source collection must not be the destination array or part thereof.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IList<(Of <<'(T>)>>), Int32, Int32) | Copies count items from the list source, starting at the index sourceIndex, to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source and destination lists may be the same.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, array<T>[]()[][], Int32, Int32) | Copies count items from the list or array source, starting at the index sourceIndex, to the array dest, starting at the index destIndex. The source may be the same as the destination array.
Count<(Of <<'(T>)>>) | Count the number of items in an IEnumerable<T> collection. If a more specific collection type is being used, it is more efficient to use the Count property, if one is provided.
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T) | Counts the number of items in the collection that are equal to find.
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Counts the number of items in the collection that are equal to find.
CountWhere<(Of <<'(T>)>>) | Counts the number of items in the collection that satisfy the condition defined by predicate.
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The two collections do not need to be of the same type; it is permissible to compare an array and an OrderedBag, for instance.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Determines if the two collections contain "equal" items in the same order. The passed BinaryPredicate is used to determine if two items are "equal".
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.
Exists<(Of <<'(T>)>>) | Determines if a collection contains any item that satisfies the condition defined by predicate.
Fill<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Replaces each item in a list with a given value. The list does not change in size.
Fill<(Of <<'(T>)>>)(array<T>[]()[][], T) | Replaces each item in a array with a given value.
FillRange<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32, T) | Replaces each item in a part of a list with a given value.
FillRange<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32, T) | Replaces each item in a part of a array with a given value.
FindFirstIndexWhere<(Of <<'(T>)>>) | Finds the index of the first item in a list that satisfies the condition defined by predicate.
FindFirstWhere<(Of <<'(T>)>>) | Finds the first item in a collection that satisfies the condition defined by predicate.
FindIndicesWhere<(Of <<'(T>)>>) | Enumerates the indices of all the items in list that satisfy the condition defined by predicate.
FindLastIndexWhere<(Of <<'(T>)>>) | Finds the index of the last item in a list that satisfies the condition defined by predicate.
FindLastWhere<(Of <<'(T>)>>) | Finds the last item in a collection that satisfies the condition defined by predicate.
FindWhere<(Of <<'(T>)>>) | Enumerates all the items in collection that satisfy the condition defined by predicate.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32) | Finds the first occurence of count consecutive equal items in the list.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IEqualityComparer<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive equal items in the list. A passed IEqualityComprer is used to determine equality.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, BinaryPredicate<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".
FirstConsecutiveWhere<(Of <<'(T>)>>) | Finds the first occurence of count consecutive items in the list for which a given predicate returns true.
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the first item in a list equal to a given item.
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the first item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
ForEach<(Of <<'(T>)>>) | Performs the specified action on each item in a collection.
GeneratePermutations<(Of <<'(T>)>>) | Generates all the possible permutations of the items in collection. If collection has N items, then N factorial permutations will be generated. This method does not compare the items to determine if any of them are equal. If some items are equal, the same permutation may be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate the six permutations, AAB, AAB, ABA, ABA, BAA, BAA (not necessarily in that order). To take equal items into account, use the GenerateSortedPermutations method.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied IComparer<T> instance is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied Comparison<T> delegate is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GetCollectionEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.
GetCollectionEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal
GetComparerFromComparison<(Of <<'(T>)>>) | Given a comparison delegate that compares two items of type T, gets an IComparer<T> instance that performs the same comparison.
GetComparisonFromComparer<(Of <<'(T>)>>) | Given in IComparer<T> instenace that comparers two items from type T, gets a Comparison delegate that performs the same comparison.
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to the default value (zero or null).
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>), TValue) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.
GetIdentityComparer<(Of <<'(T>)>>) | Gets an IEqualityComparer<T> instance that can be used to compare objects of type T for object identity only. Two objects compare equal only if they are references to the same object.
GetLexicographicalComparer<(Of <<'(T>)>>)()()()() | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be used for collections or algorithms that use sequences of T as an item type. The Lexicographical ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.
GetReverseComparer<(Of <<'(T>)>>) | Reverses the order of comparison of an IComparer<T>. The resulting comparer can be used, for example, to sort a collection in descending order. Equality and hash codes are unchanged.
GetReverseComparison<(Of <<'(T>)>>) | Reverses the order of comparison of an Comparison<T>. The resulting comparison can be used, for example, to sort a collection in descending order.
GetSetEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal
GetSetEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Enumerates the indices of all the items in a list equal to a given item.
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the last item in a list equal to a given item.
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the last item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparison delegate. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparer interface. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the maximum value in a collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
MergeSorted<(Of <<'(T>)>>)(array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the natural ordering of the type (it's implementation of IComparable<T>). The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed instance of IComparer<T>. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed Comparison<T> delegate. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the minimum value in a collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
NCopiesOf<(Of <<'(T>)>>) | Creates an IEnumerator that enumerates a given item n times.
Partition<(Of <<'(T>)>>) | Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false.
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Randomly shuffles the items in a collection, yielding a new collection.
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a collection, yielding a new collection.
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Randomly shuffles the items in a list or array, in place.
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a list or array, in place.
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32, Random) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.
Range<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32) | Returns a view onto a sub-range of a list. Items from list are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Range<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32) | Returns a view onto a sub-range of an array. Items from array are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to array are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view. After an insertion, the last item in array "falls off the end". After a deletion, the last item in array becomes the default value (0 or null).
ReadOnly<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Returns a read-only view onto a collection. The returned ICollection<T> interface only allows operations that do not change the collection: GetEnumerator, Contains, CopyTo, Count. The ReadOnly property returns false, indicating that the collection is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Returns a read-only view onto a list. The returned IList<T> interface only allows operations that do not change the list: GetEnumerator, Contains, CopyTo, Count, IndexOf, and the get accessor of the indexer. The IsReadOnly property returns true, indicating that the list is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Returns a read-only view onto a dictionary. The returned IDictionary<TKey,TValue> interface only allows operations that do not change the dictionary. The IsReadOnly property returns true, indicating that the dictionary is read-only. All other methods on the interface throw a NotSupportedException.
ReadWriteList<(Of <<'(T>)>>) | Reads the write list.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. A passed IEqualityComparer is used to determine equality.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. The passed BinaryPredicate is used to determine if two items are "equal".
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Remove consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The removal is done in-place, changing the list.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove subsequent consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. The passed BinaryPredicate is used to determine if two items are "equal".
RemoveWhere<(Of <<'(T>)>>) | Removes all the items in the collection that satisfy the condition defined by predicate.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T) | Replace all items in a collection equal to a particular value with another values, yielding another collection.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a collection equal to a particular value with another values, yielding another collection. A passed IEqualityComparer is used to determine equality.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T) | Replace all items in a list or array equal to a particular value with another value. The replacement is done in-place, changing the list.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a list or array equal to a particular value with another values. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a list or array that a predicate evaluates at true with a value. The replacement is done in-place, changing the list.
Reverse<(Of <<'(T>)>>) | Reverses a list and returns the reversed list, without changing the source list.
ReverseInPlace<(Of <<'(T>)>>) | Reverses a list or array in place.
Rotate<(Of <<'(T>)>>) | Rotates a list and returns the rotated list, without changing the source list.
RotateInPlace<(Of <<'(T>)>>) | Rotates a list or array in place.
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern.
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is "equal" to the first item in pattern, list[i+1] is "equal" to the second item in pattern, and so forth for all the items in pattern. The passed BinaryPredicate is used to determine if two items are "equal".
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied IComparer<T> is used to compare the items in the collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.
StablePartition<(Of <<'(T>)>>) | Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false. The partition is stable, which means that if items X and Y have the same result from the predicate, and X precedes Y in the original list, X will precede Y in the partitioned list.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the list.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the list.
ToArray<(Of <<'(T>)>>) | Create an array with the items in a collection.
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Gets a string representation of the elements in the collection. The string representation starts with "{", has a list of items separated by commas (","), and ends with "}". Each item in the collection is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Boolean, String, String, String) | Gets a string representation of the elements in the collection. The string to used at the beginning and end, and to separate items, and supplied by parameters. Each item in the collection is converted to a string by calling its ToString method (null is represented by "null").
ToString<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Gets a string representation of the mappings in a dictionary. The string representation starts with "{", has a list of mappings separated by commas (", "), and ends with "}". Each mapping is represented by "key->value". Each key and value in the dictionary is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.
TrueForAll<(Of <<'(T>)>>) | Determines if all of the items in the collection satisfy the condition defined by predicate.
TryFindFirstWhere<(Of <<'(T>)>>) | Finds the first item in a collection that satisfies the condition defined by predicate.
TryFindLastWhere<(Of <<'(T>)>>) | Finds the last item in a collection that satisfies the condition defined by predicate.
TypedAs<(Of <<'(T>)>>)(IEnumerable) | Given a non-generic IEnumerable interface, wrap a generic IEnumerable<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(ICollection) | Given a non-generic ICollection interface, wrap a generic ICollection<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(IList) | Given a non-generic IList interface, wrap a generic IList<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic list, but can be used in places that require a generic interface. The underlying non-generic list must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic lists to newer code that uses generic interfaces.
Untyped<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Given a generic ICollection<T> interface, wrap a non-generic (untyped) ICollection interface around it. The non-generic interface will contain the same objects as the underlying generic collection, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.
Untyped<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Given a generic IList<T> interface, wrap a non-generic (untyped) IList interface around it. The non-generic interface will contain the same objects as the underlying generic list, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

See Also

Algorithms Class


Algorithms Methods

The Algorithms type exposes the following members.

Methods

Name | Description
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the natural ordering of the type (it's implementation of IComparable<T>).
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IComparer<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed instance of IComparer<T>.
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Comparison<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed Comparison<T> delegate.
CartesianProduct<(Of <<'(TFirst, TSecond>)>>) | Computes the cartestian product of two collections: all possible pairs of items, with the first item taken from the first collection and the second item taken from the second collection. If the first collection has N items, and the second collection has M items, the cartesian product will have N * M pairs.
Concatenate<(Of <<'(T>)>>) | Concatenates all the items from several collections. The collections need not be of the same type, but must have the same item type.
Convert<(Of <<'(TSource, TDest>)>>) | Convert a collection of items by applying a delegate to each item in the collection. The resulting collection contains the result of applying converter to each item in sourceCollection, in order.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32) | Copies all of the items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32) | Copies all of the items from the collection source to the array dest, starting at the index destIndex.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32, Int32) | Copies at most count items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source collection must not be the destination list or part thereof.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32, Int32) | Copies at most count items from the collection source to the array dest, starting at the index destIndex. The source collection must not be the destination array or part thereof.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IList<(Of <<'(T>)>>), Int32, Int32) | Copies count items from the list source, starting at the index sourceIndex, to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source and destination lists may be the same.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, array<T>[]()[][], Int32, Int32) | Copies count items from the list or array source, starting at the index sourceIndex, to the array dest, starting at the index destIndex. The source may be the same as the destination array.
Count<(Of <<'(T>)>>) | Count the number of items in an IEnumerable<T> collection. If a more specific collection type is being used, it is more efficient to use the Count property, if one is provided.
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T) | Counts the number of items in the collection that are equal to find.
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Counts the number of items in the collection that are equal to find.
CountWhere<(Of <<'(T>)>>) | Counts the number of items in the collection that satisfy the condition defined by predicate.
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The two collections do not need to be of the same type; it is permissible to compare an array and an OrderedBag, for instance.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Determines if the two collections contain "equal" items in the same order. The passed BinaryPredicate is used to determine if two items are "equal".
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.
Exists<(Of <<'(T>)>>) | Determines if a collection contains any item that satisfies the condition defined by predicate.
Fill<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Replaces each item in a list with a given value. The list does not change in size.
Fill<(Of <<'(T>)>>)(array<T>[]()[][], T) | Replaces each item in a array with a given value.
FillRange<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32, T) | Replaces each item in a part of a list with a given value.
FillRange<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32, T) | Replaces each item in a part of a array with a given value.
FindFirstIndexWhere<(Of <<'(T>)>>) | Finds the index of the first item in a list that satisfies the condition defined by predicate.
FindFirstWhere<(Of <<'(T>)>>) | Finds the first item in a collection that satisfies the condition defined by predicate.
FindIndicesWhere<(Of <<'(T>)>>) | Enumerates the indices of all the items in list that satisfy the condition defined by predicate.
FindLastIndexWhere<(Of <<'(T>)>>) | Finds the index of the last item in a list that satisfies the condition defined by predicate.
FindLastWhere<(Of <<'(T>)>>) | Finds the last item in a collection that satisfies the condition defined by predicate.
FindWhere<(Of <<'(T>)>>) | Enumerates all the items in collection that satisfy the condition defined by predicate.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32) | Finds the first occurence of count consecutive equal items in the list.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IEqualityComparer<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive equal items in the list. A passed IEqualityComprer is used to determine equality.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, BinaryPredicate<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".
FirstConsecutiveWhere<(Of <<'(T>)>>) | Finds the first occurence of count consecutive items in the list for which a given predicate returns true.
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the first item in a list equal to a given item.
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the first item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
ForEach<(Of <<'(T>)>>) | Performs the specified action on each item in a collection.
GeneratePermutations<(Of <<'(T>)>>) | Generates all the possible permutations of the items in collection. If collection has N items, then N factorial permutations will be generated. This method does not compare the items to determine if any of them are equal. If some items are equal, the same permutation may be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate the six permutations, AAB, AAB, ABA, ABA, BAA, BAA (not necessarily in that order). To take equal items into account, use the GenerateSortedPermutations method.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied IComparer<T> instance is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied Comparison<T> delegate is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GetCollectionEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.
GetCollectionEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal
GetComparerFromComparison<(Of <<'(T>)>>) | Given a comparison delegate that compares two items of type T, gets an IComparer<T> instance that performs the same comparison.
GetComparisonFromComparer<(Of <<'(T>)>>) | Given in IComparer<T> instenace that comparers two items from type T, gets a Comparison delegate that performs the same comparison.
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to the default value (zero or null).
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>), TValue) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.
GetIdentityComparer<(Of <<'(T>)>>) | Gets an IEqualityComparer<T> instance that can be used to compare objects of type T for object identity only. Two objects compare equal only if they are references to the same object.
GetLexicographicalComparer<(Of <<'(T>)>>)()()()() | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be used for collections or algorithms that use sequences of T as an item type. The Lexicographical ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.
GetReverseComparer<(Of <<'(T>)>>) | Reverses the order of comparison of an IComparer<T>. The resulting comparer can be used, for example, to sort a collection in descending order. Equality and hash codes are unchanged.
GetReverseComparison<(Of <<'(T>)>>) | Reverses the order of comparison of an Comparison<T>. The resulting comparison can be used, for example, to sort a collection in descending order.
GetSetEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal
GetSetEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Enumerates the indices of all the items in a list equal to a given item.
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the last item in a list equal to a given item.
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the last item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparison delegate. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparer interface. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the maximum value in a collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
MergeSorted<(Of <<'(T>)>>)(array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the natural ordering of the type (it's implementation of IComparable<T>). The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed instance of IComparer<T>. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed Comparison<T> delegate. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the minimum value in a collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
NCopiesOf<(Of <<'(T>)>>) | Creates an IEnumerator that enumerates a given item n times.
Partition<(Of <<'(T>)>>) | Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false.
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Randomly shuffles the items in a collection, yielding a new collection.
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a collection, yielding a new collection.
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Randomly shuffles the items in a list or array, in place.
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a list or array, in place.
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32, Random) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.
Range<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32) | Returns a view onto a sub-range of a list. Items from list are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Range<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32) | Returns a view onto a sub-range of an array. Items from array are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to array are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view. After an insertion, the last item in array "falls off the end". After a deletion, the last item in array becomes the default value (0 or null).
ReadOnly<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Returns a read-only view onto a collection. The returned ICollection<T> interface only allows operations that do not change the collection: GetEnumerator, Contains, CopyTo, Count. The ReadOnly property returns false, indicating that the collection is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Returns a read-only view onto a list. The returned IList<T> interface only allows operations that do not change the list: GetEnumerator, Contains, CopyTo, Count, IndexOf, and the get accessor of the indexer. The IsReadOnly property returns true, indicating that the list is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Returns a read-only view onto a dictionary. The returned IDictionary<TKey,TValue> interface only allows operations that do not change the dictionary. The IsReadOnly property returns true, indicating that the dictionary is read-only. All other methods on the interface throw a NotSupportedException.
ReadWriteList<(Of <<'(T>)>>) | Reads the write list.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. A passed IEqualityComparer is used to determine equality.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. The passed BinaryPredicate is used to determine if two items are "equal".
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Remove consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The removal is done in-place, changing the list.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove subsequent consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. The passed BinaryPredicate is used to determine if two items are "equal".
RemoveWhere<(Of <<'(T>)>>) | Removes all the items in the collection that satisfy the condition defined by predicate.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T) | Replace all items in a collection equal to a particular value with another values, yielding another collection.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a collection equal to a particular value with another values, yielding another collection. A passed IEqualityComparer is used to determine equality.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T) | Replace all items in a list or array equal to a particular value with another value. The replacement is done in-place, changing the list.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a list or array equal to a particular value with another values. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a list or array that a predicate evaluates at true with a value. The replacement is done in-place, changing the list.
Reverse<(Of <<'(T>)>>) | Reverses a list and returns the reversed list, without changing the source list.
ReverseInPlace<(Of <<'(T>)>>) | Reverses a list or array in place.
Rotate<(Of <<'(T>)>>) | Rotates a list and returns the rotated list, without changing the source list.
RotateInPlace<(Of <<'(T>)>>) | Rotates a list or array in place.
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern.
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is "equal" to the first item in pattern, list[i+1] is "equal" to the second item in pattern, and so forth for all the items in pattern. The passed BinaryPredicate is used to determine if two items are "equal".
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied IComparer<T> is used to compare the items in the collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.
StablePartition<(Of <<'(T>)>>) | Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false. The partition is stable, which means that if items X and Y have the same result from the predicate, and X precedes Y in the original list, X will precede Y in the partitioned list.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the list.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the list.
ToArray<(Of <<'(T>)>>) | Create an array with the items in a collection.
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Gets a string representation of the elements in the collection. The string representation starts with "{", has a list of items separated by commas (","), and ends with "}". Each item in the collection is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Boolean, String, String, String) | Gets a string representation of the elements in the collection. The string to used at the beginning and end, and to separate items, and supplied by parameters. Each item in the collection is converted to a string by calling its ToString method (null is represented by "null").
ToString<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Gets a string representation of the mappings in a dictionary. The string representation starts with "{", has a list of mappings separated by commas (", "), and ends with "}". Each mapping is represented by "key->value". Each key and value in the dictionary is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.
TrueForAll<(Of <<'(T>)>>) | Determines if all of the items in the collection satisfy the condition defined by predicate.
TryFindFirstWhere<(Of <<'(T>)>>) | Finds the first item in a collection that satisfies the condition defined by predicate.
TryFindLastWhere<(Of <<'(T>)>>) | Finds the last item in a collection that satisfies the condition defined by predicate.
TypedAs<(Of <<'(T>)>>)(IEnumerable) | Given a non-generic IEnumerable interface, wrap a generic IEnumerable<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(ICollection) | Given a non-generic ICollection interface, wrap a generic ICollection<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(IList) | Given a non-generic IList interface, wrap a generic IList<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic list, but can be used in places that require a generic interface. The underlying non-generic list must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic lists to newer code that uses generic interfaces.
Untyped<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Given a generic ICollection<T> interface, wrap a non-generic (untyped) ICollection interface around it. The non-generic interface will contain the same objects as the underlying generic collection, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.
Untyped<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Given a generic IList<T> interface, wrap a non-generic (untyped) IList interface around it. The non-generic interface will contain the same objects as the underlying generic list, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

See Also

Algorithms Class


BinarySearch Method

GhostDoc Pro Sample Help File

Algorithms..::..BinarySearch Method

Overload List

Name | Description
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the natural ordering of the type (it's implementation of IComparable<T>).
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IComparer<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed instance of IComparer<T>.
BinarySearch<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, Comparison<(Of <<'(T>)>>), Int32%) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed Comparison<T> delegate.

See Also

Algorithms Class
Algorithms Members


BinarySearch(T) Method (IList(T), T, Int32)

Algorithms..::..BinarySearch<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, Int32%)

Searches a sorted list for an item via binary search. The list must be sorted by the natural ordering of the type (it's implementation of IComparable<T>).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int BinarySearch<T>(
    IList<T> list,
    T item,
    out int index
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function BinarySearch(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    item As T, _
    <OutAttribute> ByRef index As Integer _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ BinarySearch(
    IList<T>^ list,
    T item,
    [OutAttribute] int^% index
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The sorted list to search.
item
Type: T
The item to search for.
index
Type: Int32 %
Returns the first index at which the item can be found. If the return value is zero, indicating that item was not present in the list, then this returns the index at which item could be inserted to maintain the sorted order of the list.

Return Value

The number of items equal to item that appear in the list.

See Also

Algorithms Class
BinarySearch Overload


BinarySearch(T) Method (IList(T), T, IComparer(T), Int32)

Algorithms..::..BinarySearch<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, IComparer<(Of <(<'T>)>)>, Int32%)

Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed instance of IComparer<T>.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int BinarySearch<T>(
    IList<T> list,
    T item,
    IComparer<T> comparer,
    out int index
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function BinarySearch(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    item As T, _
    comparer As IComparer(Of T), _
    <OutAttribute> ByRef index As Integer _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ BinarySearch(
    IList<T>^ list,
    T item,
    IComparer<T>^ comparer,
    [OutAttribute] int^% index
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The sorted list to search.
item
Type: T
The item to search for.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to sort the list. Only the Compare method is used.
index
Type: Int32 %
Returns the first index at which the item can be found. If the return value is zero, indicating that item was not present in the list, then this returns the index at which item could be inserted to maintain the sorted order of the list.

Return Value

The number of items equal to item that appear in the list.

See Also

Algorithms Class
BinarySearch Overload


BinarySearch(T) Method (IList(T), T, Comparison(T), Int32)

Algorithms..::..BinarySearch<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, Comparison<(Of <(<'T>)>)>, Int32%)

Searches a sorted list for an item via binary search. The list must be sorted by the ordering in the passed Comparison<T> delegate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int BinarySearch<T>(
    IList<T> list,
    T item,
    Comparison<T> comparison,
    out int index
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function BinarySearch(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    item As T, _
    comparison As Comparison(Of T), _
    <OutAttribute> ByRef index As Integer _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ BinarySearch(
    IList<T>^ list,
    T item,
    Comparison<T>^ comparison,
    [OutAttribute] int^% index
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The sorted list to search.
item
Type: T
The item to search for.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to sort the list.
index
Type: Int32 %
Returns the first index at which the item can be found. If the return value is zero, indicating that item was not present in the list, then this returns the index at which item could be inserted to maintain the sorted order of the list.

Return Value

The number of items equal to item that appear in the list.

See Also

Algorithms Class
BinarySearch Overload


CartesianProduct(TFirst, TSecond) Method

Algorithms..::..CartesianProduct<(Of <(<'TFirst, TSecond>)>)> Method

Computes the cartestian product of two collections: all possible pairs of items, with the first item taken from the first collection and the second item taken from the second collection. If the first collection has N items, and the second collection has M items, the cartesian product will have N * M pairs.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<Pair<TFirst, TSecond>> CartesianProduct<TFirst, TSecond>(
    IEnumerable<TFirst> first,
    IEnumerable<TSecond> second
)

Public Shared Function CartesianProduct(Of TFirst, TSecond) ( _
    first As IEnumerable(Of TFirst), _
    second As IEnumerable(Of TSecond) _
) As IEnumerable(Of Pair(Of TFirst, TSecond))
public:
generic<typename TFirst, typename TSecond>
static IEnumerable<Pair<TFirst, TSecond>^>^ CartesianProduct(
    IEnumerable<TFirst>^ first,
    IEnumerable<TSecond>^ second
)

Type Parameters

TFirst
The type of items in the first collection.
TSecond
The type of items in the second collection.

Parameters

first
Type: IEnumerable <(Of <(<'TFirst>)>)>
The first collection.
second
Type: IEnumerable <(Of <(<'TSecond>)>)>
The second collection.

Return Value

An IEnumerable<Pair<TFirst, TSecond>> that enumerates the cartesian product of the two collections.

See Also

Algorithms Class


Concatenate(T) Method

Algorithms..::..Concatenate<(Of <(<'T>)>)> Method

Concatenates all the items from several collections. The collections need not be of the same type, but must have the same item type.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Concatenate<T>(
    params IEnumerable<T>[] collections
)

Public Shared Function Concatenate(Of T) ( _
    ParamArray collections As IEnumerable(Of T)() _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Concatenate(
    ... array<IEnumerable<T>^>^ collections
)

Type Parameters

T

Parameters

collections
Type: array<IEnumerable<(Of <(<'T>)>)>>[]()[][]
The set of collections to concatenate. In many languages, this parameter can be specified as several individual parameters.

Return Value

An IEnumerable that enumerates all the items in each of the collections, in order.

See Also

Algorithms Class


Convert(TSource, TDest) Method

Algorithms..::..Convert<(Of <(<'TSource, TDest>)>)> Method

Convert a collection of items by applying a delegate to each item in the collection. The resulting collection contains the result of applying converter to each item in sourceCollection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<TDest> Convert<TSource, TDest>(
    IEnumerable<TSource> sourceCollection,
    Converter<TSource, TDest> converter
)

Public Shared Function Convert(Of TSource, TDest) ( _
    sourceCollection As IEnumerable(Of TSource), _
    converter As Converter(Of TSource, TDest) _
) As IEnumerable(Of TDest)
public:
generic<typename TSource, typename TDest>
static IEnumerable<TDest>^ Convert(
    IEnumerable<TSource>^ sourceCollection,
    Converter<TSource, TDest>^ converter
)

Type Parameters

TSource
The type of items in the collection to convert.
TDest
The type each item is being converted to.

Parameters

sourceCollection
Type: IEnumerable <(Of <(<'TSource>)>)>
The collection of item being converted.
converter
Type: Converter <(Of <(<'TSource, TDest>)>)>
A delegate to the method to call, passing each item in sourceCollection.

Return Value

The resulting collection from applying converter to each item in sourceCollection, in order.

Exceptions

Exception | Condition
ArgumentNullException | sourceCollection or converter is null.

See Also

Algorithms Class


Copy Method

Algorithms..::..Copy Method

Overload List

Name | Description
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32) | Copies all of the items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32) | Copies all of the items from the collection source to the array dest, starting at the index destIndex.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IList<(Of <<'(T>)>>), Int32, Int32) | Copies at most count items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source collection must not be the destination list or part thereof.
Copy<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), array<T>[]()[][], Int32, Int32) | Copies at most count items from the collection source to the array dest, starting at the index destIndex. The source collection must not be the destination array or part thereof.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IList<(Of <<'(T>)>>), Int32, Int32) | Copies count items from the list source, starting at the index sourceIndex, to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source and destination lists may be the same.
Copy<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, array<T>[]()[][], Int32, Int32) | Copies count items from the list or array source, starting at the index sourceIndex, to the array dest, starting at the index destIndex. The source may be the same as the destination array.

See Also

Algorithms Class
Algorithms Members


Copy(T) Method (IEnumerable(T), IList(T), Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IList<(Of <(<'T>)>)>, Int32)

Copies all of the items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IEnumerable<T> source,
    IList<T> dest,
    int destIndex
)

Public Shared Sub Copy(Of T) ( _
    source As IEnumerable(Of T), _
    dest As IList(Of T), _
    destIndex As Integer _
)
public:
generic<typename T>
static void Copy(
    IEnumerable<T>^ source,
    IList<T>^ dest,
    int^ destIndex
)

Type Parameters

T

Parameters

source
Type: IEnumerable <(Of <(<'T>)>)>
The collection that provide the source items.
dest
Type: IList <(Of <(<'T>)>)>
The list to store the items into.
destIndex
Type: Int32
The index to begin copying items to.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Count.
ArgumentNullException | source or dest is null.

See Also

Algorithms Class
Copy Overload


Copy(T) Method (IEnumerable(T), T[], Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, array<T>[]()[][], Int32)

Copies all of the items from the collection source to the array dest, starting at the index destIndex.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IEnumerable<T> source,
    T[] dest,
    int destIndex
)

Public Shared Sub Copy(Of T) ( _
    source As IEnumerable(Of T), _
    dest As T(), _
    destIndex As Integer _
)
public:
generic<typename T>
static void Copy(
    IEnumerable<T>^ source,
    array<T>^ dest,
    int^ destIndex
)

Type Parameters

T

Parameters

source
Type: IEnumerable <(Of <(<'T>)>)>
The collection that provide the source items.
dest
Type: array<T>[]()[][]
The array to store the items into.
destIndex
Type: Int32
The index to begin copying items to.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Length.
ArgumentNullException | source or dest is null.
ArgumentException | The collection has more items than will fit into the array. In this case, the array has been filled with as many items as fit before the exception is thrown.

See Also

Algorithms Class
Copy Overload


Copy(T) Method (IEnumerable(T), IList(T), Int32, Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IList<(Of <(<'T>)>)>, Int32, Int32)

Copies at most count items from the collection source to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source collection must not be the destination list or part thereof.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IEnumerable<T> source,
    IList<T> dest,
    int destIndex,
    int count
)

Public Shared Sub Copy(Of T) ( _
    source As IEnumerable(Of T), _
    dest As IList(Of T), _
    destIndex As Integer, _
    count As Integer _
)
public:
generic<typename T>
static void Copy(
    IEnumerable<T>^ source,
    IList<T>^ dest,
    int^ destIndex,
    int^ count
)

Type Parameters

T

Parameters

source
Type: IEnumerable <(Of <(<'T>)>)>
The collection that provide the source items.
dest
Type: IList <(Of <(<'T>)>)>
The list to store the items into.
destIndex
Type: Int32
The index to begin copying items to.
count
Type: Int32
The maximum number of items to copy.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Count
ArgumentOutOfRangeException | count is negative.
ArgumentNullException | source or dest is null.

See Also

Algorithms Class
Copy Overload


Copy(T) Method (IEnumerable(T), T[], Int32, Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, array<T>[]()[][], Int32, Int32)

Copies at most count items from the collection source to the array dest, starting at the index destIndex. The source collection must not be the destination array or part thereof.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IEnumerable<T> source,
    T[] dest,
    int destIndex,
    int count
)

Public Shared Sub Copy(Of T) ( _
    source As IEnumerable(Of T), _
    dest As T(), _
    destIndex As Integer, _
    count As Integer _
)
public:
generic<typename T>
static void Copy(
    IEnumerable<T>^ source,
    array<T>^ dest,
    int^ destIndex,
    int^ count
)

Type Parameters

T

Parameters

source
Type: IEnumerable <(Of <(<'T>)>)>
The collection that provide the source items.
dest
Type: array<T>[]()[][]
The array to store the items into.
destIndex
Type: Int32
The index to begin copying items to.
count
Type: Int32
The maximum number of items to copy. The array must be large enought to fit this number of items.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Length.
ArgumentOutOfRangeException | count is negative or destIndex + count is greater than dest.Length.
ArgumentNullException | source or dest is null.

See Also

Algorithms Class
Copy Overload


Copy(T) Method (IList(T), Int32, IList(T), Int32, Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, IList<(Of <(<'T>)>)>, Int32, Int32)

Copies count items from the list source, starting at the index sourceIndex, to the list dest, starting at the index destIndex. If necessary, the size of the destination list is expanded. The source and destination lists may be the same.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IList<T> source,
    int sourceIndex,
    IList<T> dest,
    int destIndex,
    int count
)

Public Shared Sub Copy(Of T) ( _
    source As IList(Of T), _
    sourceIndex As Integer, _
    dest As IList(Of T), _
    destIndex As Integer, _
    count As Integer _
)
public:
generic<typename T>
static void Copy(
    IList<T>^ source,
    int^ sourceIndex,
    IList<T>^ dest,
    int^ destIndex,
    int^ count
)

Type Parameters

T

Parameters

source
Type: IList <(Of <(<'T>)>)>
The collection that provide the source items.
sourceIndex
Type: Int32
The index within sourceto begin copying items from.
dest
Type: IList <(Of <(<'T>)>)>
The list to store the items into.
destIndex
Type: Int32
The index within destto begin copying items to.
count
Type: Int32
The maximum number of items to copy.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | sourceIndex is negative or greater than source.Count
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Count
ArgumentOutOfRangeException | count is negative or too large.
ArgumentNullException | source or dest is null.

See Also

Algorithms Class
Copy Overload


Copy(T) Method (IList(T), Int32, T[], Int32, Int32)

Algorithms..::..Copy<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, array<T>[]()[][], Int32, Int32)

Copies count items from the list or array source, starting at the index sourceIndex, to the array dest, starting at the index destIndex. The source may be the same as the destination array.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Copy<T>(
    IList<T> source,
    int sourceIndex,
    T[] dest,
    int destIndex,
    int count
)

Public Shared Sub Copy(Of T) ( _
    source As IList(Of T), _
    sourceIndex As Integer, _
    dest As T(), _
    destIndex As Integer, _
    count As Integer _
)
public:
generic<typename T>
static void Copy(
    IList<T>^ source,
    int^ sourceIndex,
    array<T>^ dest,
    int^ destIndex,
    int^ count
)

Type Parameters

T

Parameters

source
Type: IList <(Of <(<'T>)>)>
The list or array that provide the source items.
sourceIndex
Type: Int32
The index within sourceto begin copying items from.
dest
Type: array<T>[]()[][]
The array to store the items into.
destIndex
Type: Int32
The index within destto begin copying items to.
count
Type: Int32
The maximum number of items to copy. The destination array must be large enough to hold this many items.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | sourceIndex is negative or greater than source.Count
ArgumentOutOfRangeException | destIndex is negative or greater than dest.Length
ArgumentOutOfRangeException | count is negative or too large.
ArgumentNullException | source or dest is null.

See Also

Algorithms Class
Copy Overload


Count(T) Method

Algorithms..::..Count<(Of <(<'T>)>)> Method

Count the number of items in an IEnumerable<T> collection. If a more specific collection type is being used, it is more efficient to use the Count property, if one is provided.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int Count<T>(
    IEnumerable<T> collection
)

Public Shared Function Count(Of T) ( _
    collection As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
static int^ Count(
    IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to count items in.

Return Value

The number of items in the collection.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

If the collection implements ICollection<T>, this method simply returns ICollection<T>.Count. Otherwise, it enumerates all items and counts them.

See Also

Algorithms Class


CountEqual Method

Algorithms..::..CountEqual Method

Overload List

Name | Description
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T) | Counts the number of items in the collection that are equal to find.
CountEqual<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Counts the number of items in the collection that are equal to find.

See Also

Algorithms Class
Algorithms Members


CountEqual(T) Method (IEnumerable(T), T)

Algorithms..::..CountEqual<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, T)

Counts the number of items in the collection that are equal to find.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int CountEqual<T>(
    IEnumerable<T> collection,
    T find
)

Public Shared Function CountEqual(Of T) ( _
    collection As IEnumerable(Of T), _
    find As T _
) As Integer
public:
generic<typename T>
static int^ CountEqual(
    IEnumerable<T>^ collection,
    T find
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to count items in.
find
Type: T
The item to compare to.

Return Value

The number of items in the collection that are equal to find.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
CountEqual Overload


CountEqual(T) Method (IEnumerable(T), T, IEqualityComparer(T))

Algorithms..::..CountEqual<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, T, IEqualityComparer<(Of <(<'T>)>)>)

Counts the number of items in the collection that are equal to find.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int CountEqual<T>(
    IEnumerable<T> collection,
    T find,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function CountEqual(Of T) ( _
    collection As IEnumerable(Of T), _
    find As T, _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ CountEqual(
    IEnumerable<T>^ collection,
    T find,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to count items in.
find
Type: T
The item to compare to.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The comparer to use to determine if two items are equal. Only the Equals member function will be called.

Return Value

The number of items in the collection that are equal to find.

Exceptions

Exception | Condition
ArgumentException | collection or equalityComparer is null.

See Also

Algorithms Class
CountEqual Overload


CountWhere(T) Method

Algorithms..::..CountWhere<(Of <(<'T>)>)> Method

Counts the number of items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int CountWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function CountWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ CountWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to count items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

The number of items in the collection that satisfy predicate.

See Also

Algorithms Class


DisjointSets Method

Algorithms..::..DisjointSets Method

Overload List

Name | Description
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
DisjointSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.

See Also

Algorithms Class
Algorithms Members


DisjointSets(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..DisjointSets<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool DisjointSets<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function DisjointSets(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ DisjointSets(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.

Return Value

True if collection1 are collection2 are disjoint, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsDisjoint method on that class.

See Also

Algorithms Class
DisjointSets Overload


DisjointSets(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..DisjointSets<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool DisjointSets<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function DisjointSets(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ DisjointSets(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparerComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

True if collection1 are collection2 are disjoint, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsDisjoint method on that class.

See Also

Algorithms Class
DisjointSets Overload


EqualCollections Method

Algorithms..::..EqualCollections Method

Overload List

Name | Description
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The two collections do not need to be of the same type; it is permissible to compare an array and an OrderedBag, for instance.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if the two collections contain equal items in the same order. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.
EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Determines if the two collections contain "equal" items in the same order. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


EqualCollections(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..EqualCollections<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Determines if the two collections contain equal items in the same order. The two collections do not need to be of the same type; it is permissible to compare an array and an OrderedBag, for instance.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool EqualCollections<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function EqualCollections(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ EqualCollections(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T
The type of items in the collections.

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to compare.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to compare.

Return Value

True if the collections have equal items in the same order. If both collections are empty, true is returned.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
EqualCollections Overload


EqualCollections(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..EqualCollections<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Determines if the two collections contain equal items in the same order. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool EqualCollections<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function EqualCollections(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ EqualCollections(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T
The type of items in the collections.

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to compare.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to compare.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals member function of this interface is called.

Return Value

True if the collections have equal items in the same order. If both collections are empty, true is returned.

Exceptions

Exception | Condition
ArgumentNullException | collection1, collection2, or equalityComparer is null.

See Also

Algorithms Class
EqualCollections Overload


EqualCollections(T) Method (IEnumerable(T), IEnumerable(T), BinaryPredicate(T))

Algorithms..::..EqualCollections<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Determines if the two collections contain "equal" items in the same order. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool EqualCollections<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    BinaryPredicate<T> predicate
)

Public Shared Function EqualCollections(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ EqualCollections(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T
The type of items in the collections.

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to compare.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to compare.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality". This predicate can compute any relation between two items; it need not represent equality or an equivalence relation.

Return Value

True if predicatereturns true for each corresponding pair of items in the two collections. If both collections are empty, true is returned.

Exceptions

Exception | Condition
ArgumentNullException | collection1, collection2, or predicate is null.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being tested for need not be equality. For example, the following code determines if each integer in list1 is less than or equal to the corresponding integer in list2.
C#
List<int> list1, list2;
if (EqualCollections(list1, list2, delegate(int x, int y) { return x <= y; }) {
    // the check is true...
}

See Also

Algorithms Class
EqualCollections Overload


EqualSets Method

Algorithms..::..EqualSets Method

Overload List

Name | Description
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.
EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.

See Also

Algorithms Class
Algorithms Members


EqualSets(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..EqualSets<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool EqualSets<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function EqualSets(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ EqualSets(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.

Return Value

True if collection1 are collection2 are equal, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the EqualTo method on that class.

See Also

Algorithms Class
EqualSets Overload


EqualSets(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..EqualSets<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Determines if two collections are equal, considered as sets. Two sets are equal if they have have the same items, with order not being significant.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool EqualSets<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function EqualSets(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ EqualSets(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

True if collection1 are collection2 are equal, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the EqualTo method on that class.

See Also

Algorithms Class
EqualSets Overload


Exists(T) Method

Algorithms..::..Exists<(Of <(<'T>)>)> Method

Determines if a collection contains any item that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool Exists<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function Exists(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ Exists(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to check all the items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

True if the collection contains one or more items that satisfy the condition defined by predicate. False if the collection does not contain an item that satisfies predicate.

See Also

Algorithms Class


Fill Method

Algorithms..::..Fill Method

Overload List

Name | Description
Fill<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Replaces each item in a list with a given value. The list does not change in size.
Fill<(Of <<'(T>)>>)(array<T>[]()[][], T) | Replaces each item in a array with a given value.

See Also

Algorithms Class
Algorithms Members


Fill(T) Method (IList(T), T)

Algorithms..::..Fill<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T)

Replaces each item in a list with a given value. The list does not change in size.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Fill<T>(
    IList<T> list,
    T value
)

Public Shared Sub Fill(Of T) ( _
    list As IList(Of T), _
    value As T _
)
public:
generic<typename T>
static void Fill(
    IList<T>^ list,
    T value
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to modify.
value
Type: T
The value to fill with.

Exceptions

Exception | Condition
ArgumentException | list is a read-only list.
ArgumentNullException | list is null.

See Also

Algorithms Class
Fill Overload


Fill(T) Method (T[], T)

Algorithms..::..Fill<(Of <(<'T>)>)> Method (array<T>[]()[][], T)

Replaces each item in a array with a given value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void Fill<T>(
    T[] array,
    T value
)

Public Shared Sub Fill(Of T) ( _
    array As T(), _
    value As T _
)
public:
generic<typename T>
static void Fill(
    array<T>^ array,
    T value
)

Type Parameters

T

Parameters

array
Type: array<T>[]()[][]
The array to modify.
value
Type: T
The value to fill with.

Exceptions

Exception | Condition
ArgumentNullException | array is null.

See Also

Algorithms Class
Fill Overload


FillRange Method

Algorithms..::..FillRange Method

Overload List

Name | Description
FillRange<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32, T) | Replaces each item in a part of a list with a given value.
FillRange<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32, T) | Replaces each item in a part of a array with a given value.

See Also

Algorithms Class
Algorithms Members


FillRange(T) Method (IList(T), Int32, Int32, T)

Algorithms..::..FillRange<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, Int32, T)

Replaces each item in a part of a list with a given value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void FillRange<T>(
    IList<T> list,
    int start,
    int count,
    T value
)

Public Shared Sub FillRange(Of T) ( _
    list As IList(Of T), _
    start As Integer, _
    count As Integer, _
    value As T _
)
public:
generic<typename T>
static void FillRange(
    IList<T>^ list,
    int^ start,
    int^ count,
    T value
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to modify.
start
Type: Int32
The index at which to start filling. The first index in the list has index 0.
count
Type: Int32
The number of items to fill.
value
Type: T
The value to fill with.

Exceptions

Exception | Condition
ArgumentException | list is a read-only list.
ArgumentOutOfRangeException | start or count is negative, or start + count is greater than list.Count.
ArgumentNullException | list is null.

See Also

Algorithms Class
FillRange Overload


FillRange(T) Method (T[], Int32, Int32, T)

Algorithms..::..FillRange<(Of <(<'T>)>)> Method (array<T>[]()[][], Int32, Int32, T)

Replaces each item in a part of a array with a given value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void FillRange<T>(
    T[] array,
    int start,
    int count,
    T value
)

Public Shared Sub FillRange(Of T) ( _
    array As T(), _
    start As Integer, _
    count As Integer, _
    value As T _
)
public:
generic<typename T>
static void FillRange(
    array<T>^ array,
    int^ start,
    int^ count,
    T value
)

Type Parameters

T

Parameters

array
Type: array<T>[]()[][]
The array to modify.
start
Type: Int32
The index at which to start filling. The first index in the array has index 0.
count
Type: Int32
The number of items to fill.
value
Type: T
The value to fill with.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | start or count is negative, or start + count is greater than array.Length.
ArgumentNullException | array is null.

See Also

Algorithms Class
FillRange Overload


FindFirstIndexWhere(T) Method

Algorithms..::..FindFirstIndexWhere<(Of <(<'T>)>)> Method

Finds the index of the first item in a list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FindFirstIndexWhere<T>(
    IList<T> list,
    Predicate<T> predicate
)

Public Shared Function FindFirstIndexWhere(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ FindFirstIndexWhere(
    IList<T>^ list,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item satisfying the condition. -1 if no such item exists in the list.

See Also

Algorithms Class


FindFirstWhere(T) Method

Algorithms..::..FindFirstWhere<(Of <(<'T>)>)> Method

Finds the first item in a collection that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T FindFirstWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function FindFirstWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As T
public:
generic<typename T>
static T FindFirstWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.

Return Value

The first item in the collection that matches the condition, or the default value for T (0 or null) if no item that matches the condition is found.

Remarks

If the default value for T could be present in the collection, and would be matched by the predicate, then this method is inappropriate, because you cannot disguish whether the default value for T was actually present in the collection, or no items matched the predicate. In this case, use TryFindFirstWhere.

See Also

Algorithms Class
Wintellect.PowerCollections Namespace
Algorithms..::..TryFindFirstWhere<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T%)


FindIndicesWhere(T) Method

Algorithms..::..FindIndicesWhere<(Of <(<'T>)>)> Method

Enumerates the indices of all the items in list that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> FindIndicesWhere<T>(
    IList<T> list,
    Predicate<T> predicate
)

Public Shared Function FindIndicesWhere(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T) _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ FindIndicesWhere(
    IList<T>^ list,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to check all the items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

An IEnumerable<T> that enumerates the indices of items that satisfy the condition.

See Also

Algorithms Class


FindLastIndexWhere(T) Method

Algorithms..::..FindLastIndexWhere<(Of <(<'T>)>)> Method

Finds the index of the last item in a list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FindLastIndexWhere<T>(
    IList<T> list,
    Predicate<T> predicate
)

Public Shared Function FindLastIndexWhere(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ FindLastIndexWhere(
    IList<T>^ list,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item satisfying the condition. -1 if no such item exists in the list.

See Also

Algorithms Class


FindLastWhere(T) Method

Algorithms..::..FindLastWhere<(Of <(<'T>)>)> Method

Finds the last item in a collection that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T FindLastWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function FindLastWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As T
public:
generic<typename T>
static T FindLastWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.

Return Value

The last item in the collection that matches the condition, or the default value for T (0 or null) if no item that matches the condition is found.

Remarks

If the collection implements IList<T>, then the list is scanned in reverse until a matching item is found. Otherwise, the entire collection is iterated in the forward direction.

If the default value for T could be present in the collection, and would be matched by the predicate, then this method is inappropriate, because you cannot distinguish whether the default value for T was actually present in the collection, or no items matched the predicate. In this case, use TryFindFirstWhere.

See Also

Algorithms Class
Wintellect.PowerCollections Namespace
Algorithms..::..TryFindLastWhere<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T%)


FindWhere(T) Method

Algorithms..::..FindWhere<(Of <(<'T>)>)> Method

Enumerates all the items in collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> FindWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function FindWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ FindWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to check all the items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

An IEnumerable<T> that enumerates the items that satisfy the condition.

See Also

Algorithms Class


FirstConsecutiveEqual Method

Algorithms..::..FirstConsecutiveEqual Method

Overload List

Name | Description
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32) | Finds the first occurence of count consecutive equal items in the list.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, IEqualityComparer<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive equal items in the list. A passed IEqualityComprer is used to determine equality.
FirstConsecutiveEqual<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, BinaryPredicate<(Of <<'(T>)>>)) | Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


FirstConsecutiveEqual(T) Method (IList(T), Int32)

Algorithms..::..FirstConsecutiveEqual<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32)

Finds the first occurence of count consecutive equal items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstConsecutiveEqual<T>(
    IList<T> list,
    int count
)

Public Shared Function FirstConsecutiveEqual(Of T) ( _
    list As IList(Of T), _
    count As Integer _
) As Integer
public:
generic<typename T>
static int^ FirstConsecutiveEqual(
    IList<T>^ list,
    int^ count
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to examine.
count
Type: Int32
The number of consecutive equal items to look for. The count must be at least 1.

Return Value

The index of the first item in the first run of count consecutive equal items, or -1 if no such run exists..

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
FirstConsecutiveEqual Overload


FirstConsecutiveEqual(T) Method (IList(T), Int32, IEqualityComparer(T))

Algorithms..::..FirstConsecutiveEqual<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, IEqualityComparer<(Of <(<'T>)>)>)

Finds the first occurence of count consecutive equal items in the list. A passed IEqualityComprer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstConsecutiveEqual<T>(
    IList<T> list,
    int count,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function FirstConsecutiveEqual(Of T) ( _
    list As IList(Of T), _
    count As Integer, _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstConsecutiveEqual(
    IList<T>^ list,
    int^ count,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to examine.
count
Type: Int32
The number of consecutive equal items to look for. The count must be at least 1.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

The index of the first item in the first run of count consecutive equal items, or -1 if no such run exists.

See Also

Algorithms Class
FirstConsecutiveEqual Overload


FirstConsecutiveEqual(T) Method (IList(T), Int32, BinaryPredicate(T))

Algorithms..::..FirstConsecutiveEqual<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, BinaryPredicate<(Of <(<'T>)>)>)

Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstConsecutiveEqual<T>(
    IList<T> list,
    int count,
    BinaryPredicate<T> predicate
)

Public Shared Function FirstConsecutiveEqual(Of T) ( _
    list As IList(Of T), _
    count As Integer, _
    predicate As BinaryPredicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstConsecutiveEqual(
    IList<T>^ list,
    int^ count,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to examine.
count
Type: Int32
The number of consecutive equal items to look for. The count must be at least 1.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Return Value

The index of the first item in the first run of count consecutive equal items, or -1 if no such run exists.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being tested for need not be true equality.

See Also

Algorithms Class
FirstConsecutiveEqual Overload


FirstConsecutiveWhere(T) Method

Algorithms..::..FirstConsecutiveWhere<(Of <(<'T>)>)> Method

Finds the first occurence of count consecutive items in the list for which a given predicate returns true.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstConsecutiveWhere<T>(
    IList<T> list,
    int count,
    Predicate<T> predicate
)

Public Shared Function FirstConsecutiveWhere(Of T) ( _
    list As IList(Of T), _
    count As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstConsecutiveWhere(
    IList<T>^ list,
    int^ count,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to examine.
count
Type: Int32
The number of consecutive items to look for. The count must be at least 1.
predicate
Type: Predicate <(Of <(<'T>)>)>
The predicate used to test each item.

Return Value

The index of the first item in the first run of count items where predicate returns true for all items in the run, or -1 if no such run exists.

See Also

Algorithms Class


FirstIndexOf Method

Algorithms..::..FirstIndexOf Method

Overload List

Name | Description
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the first item in a list equal to a given item.
FirstIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

See Also

Algorithms Class
Algorithms Members


FirstIndexOf(T) Method (IList(T), T)

Algorithms..::..FirstIndexOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T)

Finds the index of the first item in a list equal to a given item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstIndexOf<T>(
    IList<T> list,
    T item
)

Public Shared Function FirstIndexOf(Of T) ( _
    list As IList(Of T), _
    item As T _
) As Integer
public:
generic<typename T>
static int^ FirstIndexOf(
    IList<T>^ list,
    T item
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.

Return Value

The index of the first item equal to item. -1 if no such item exists in the list.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
FirstIndexOf Overload


FirstIndexOf(T) Method (IList(T), T, IEqualityComparer(T))

Algorithms..::..FirstIndexOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, IEqualityComparer<(Of <(<'T>)>)>)

Finds the index of the first item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstIndexOf<T>(
    IList<T> list,
    T item,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function FirstIndexOf(Of T) ( _
    list As IList(Of T), _
    item As T, _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstIndexOf(
    IList<T>^ list,
    T item,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

The index of the first item equal to item. -1 if no such item exists in the list.

See Also

Algorithms Class
FirstIndexOf Overload


FirstIndexOfMany Method

Algorithms..::..FirstIndexOfMany Method

Overload List

Name | Description
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the first item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
FirstIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the first item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


FirstIndexOfMany(T) Method (IList(T), IEnumerable(T))

Algorithms..::..FirstIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Finds the index of the first item in a list equal to one of several given items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor
)

Public Shared Function FirstIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.

Return Value

The index of the first item equal to any of the items in the collection itemsToLookFor. -1 if no such item exists in the list.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
FirstIndexOfMany Overload


FirstIndexOfMany(T) Method (IList(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..FirstIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Finds the index of the first item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function FirstIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode methods will be called.

Return Value

The index of the first item equal to any of the items in the collection itemsToLookFor. -1 if no such item exists in the list.

See Also

Algorithms Class
FirstIndexOfMany Overload


FirstIndexOfMany(T) Method (IList(T), IEnumerable(T), BinaryPredicate(T))

Algorithms..::..FirstIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Finds the index of the first item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int FirstIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    BinaryPredicate<T> predicate
)

Public Shared Function FirstIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ FirstIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Return Value

The index of the first item "equal" to any of the items in the collection itemsToLookFor, using BinaryPredicate as the test for equality. -1 if no such item exists in the list.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being removed need not be true equality. This methods finds first item X which satisfies BinaryPredicate(X,Y), where Y is one of the items in itemsToLookFor

See Also

Algorithms Class
FirstIndexOfMany Overload


ForEach(T) Method

Algorithms..::..ForEach<(Of <(<'T>)>)> Method

Performs the specified action on each item in a collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void ForEach<T>(
    IEnumerable<T> collection,
    Action<T> action
)

Public Shared Sub ForEach(Of T) ( _
    collection As IEnumerable(Of T), _
    action As Action(Of T) _
)
public:
generic<typename T>
static void ForEach(
    IEnumerable<T>^ collection,
    Action<T>^ action
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
action
Type: Action <(Of <(<'T>)>)>
An Action delegate which is invoked for each item in collection.

See Also

Algorithms Class


GeneratePermutations(T) Method

Algorithms..::..GeneratePermutations<(Of <(<'T>)>)> Method

Generates all the possible permutations of the items in collection. If collection has N items, then N factorial permutations will be generated. This method does not compare the items to determine if any of them are equal. If some items are equal, the same permutation may be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate the six permutations, AAB, AAB, ABA, ABA, BAA, BAA (not necessarily in that order). To take equal items into account, use the GenerateSortedPermutations method.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T[]> GeneratePermutations<T>(
    IEnumerable<T> collection
)

Public Shared Function GeneratePermutations(Of T) ( _
    collection As IEnumerable(Of T) _
) As IEnumerable(Of T())
public:
generic<typename T>
static IEnumerable<array<T>^>^ GeneratePermutations(
    IEnumerable<T>^ collection
)

Type Parameters

T
The type of items to permute.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to permute.

Return Value

An IEnumerable<T[]> that enumerations all the possible permutations of the items in collection. Each permutations is returned as an array. The items in the array should be copied if they need to be used after the next permutation is generated; each permutation may reuse the same array instance.

See Also

Algorithms Class


GenerateSortedPermutations Method

Algorithms..::..GenerateSortedPermutations Method

Overload List

Name | Description
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied IComparer<T> instance is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.
GenerateSortedPermutations<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Generates all the possible permutations of the items in collection, in lexicographical order. A supplied Comparison<T> delegate is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.

See Also

Algorithms Class
Algorithms Members


GenerateSortedPermutations(T) Method (IEnumerable(T))

Algorithms..::..GenerateSortedPermutations<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Generates all the possible permutations of the items in collection, in lexicographical order. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T[]> GenerateSortedPermutations<T>(
    IEnumerable<T> collection
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GenerateSortedPermutations(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T) _
) As IEnumerable(Of T())
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<array<T>^>^ GenerateSortedPermutations(
    IEnumerable<T>^ collection
)

Type Parameters

T
The type of items to permute.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to permute.

Return Value

An IEnumerable<T[]> that enumerations all the possible permutations of the items in collection. Each permutations is returned as an array. The items in the array should be copied if they need to be used after the next permutation is generated; each permutation may reuse the same array instance.

See Also

Algorithms Class
GenerateSortedPermutations Overload


GenerateSortedPermutations(T) Method (IEnumerable(T), IComparer(T))

Algorithms..::..GenerateSortedPermutations<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Generates all the possible permutations of the items in collection, in lexicographical order. A supplied IComparer<T> instance is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T[]> GenerateSortedPermutations<T>(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GenerateSortedPermutations(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As IEnumerable(Of T())
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<array<T>^>^ GenerateSortedPermutations(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items to permute.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to permute.
comparer
Type: IComparer <(Of <(<'T>)>)>
The IComparer<T> used to compare the items.

Return Value

An IEnumerable<T[]> that enumerations all the possible permutations of the items in collection. Each permutations is returned as an array. The items in the array should be copied if they need to be used after the next permutation is generated; each permutation may reuse the same array instance.

See Also

Algorithms Class
GenerateSortedPermutations Overload


GenerateSortedPermutations(T) Method (IEnumerable(T), Comparison(T))

Algorithms..::..GenerateSortedPermutations<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Generates all the possible permutations of the items in collection, in lexicographical order. A supplied Comparison<T> delegate is used to compare the items. Even if some items are equal, the same permutation will not be generated more than once. For example, if the collections contains the three items A, A, and B, then this method will generate only the three permutations, AAB, ABA, BAA.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T[]> GenerateSortedPermutations<T>(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GenerateSortedPermutations(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As IEnumerable(Of T())
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<array<T>^>^ GenerateSortedPermutations(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items to permute.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to permute.
comparison
Type: Comparison <(Of <(<'T>)>)>
The Comparison<T> delegate used to compare the items.

Return Value

An IEnumerable<T[]> that enumerations all the possible permutations of the items in collection. Each permutations is returned as an array. The items in the array should be copied if they need to be used after the next permutation is generated; each permutation may reuse the same array instance.

See Also

Algorithms Class
GenerateSortedPermutations Overload


GetCollectionEqualityComparer Method

Algorithms..::..GetCollectionEqualityComparer Method

Overload List

Name | Description
GetCollectionEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.
GetCollectionEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal

See Also

Algorithms Class
Algorithms Members


GetCollectionEqualityComparer(T) Method

Algorithms..::..GetCollectionEqualityComparer<(Of <(<'T>)>)> Method

Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEqualityComparer<IEnumerable<T>> GetCollectionEqualityComparer<T>()

Public Shared Function GetCollectionEqualityComparer(Of T) As IEqualityComparer(Of IEnumerable(Of T))
public:
generic<typename T>
static IEqualityComparer<IEnumerable<T>^>^ GetCollectionEqualityComparer()

Type Parameters

T

Return Value

IEqualityComparer<IEnumerable<T>> implementation suitable for comparing collections of T for equality.

Examples

The following code creates a Dictionary where the keys are a collection of strings.
C#
Dictionary<IEnumerable<string>, int> =
    new Dictionary<IEnumerable<string>, int>(Algorithms.GetCollectionEqualityComparer<string>());

See Also

Algorithms Class
GetCollectionEqualityComparer Overload
Wintellect.PowerCollections Namespace
Algorithms..::..EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>))


GetCollectionEqualityComparer(T) Method (IEqualityComparer(T))

Algorithms..::..GetCollectionEqualityComparer<(Of <(<'T>)>)> Method (IEqualityComparer<(Of <(<'T>)>)>)

Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, considered in order. This is the same notion of equality as in Algorithms.EqualCollections, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.

An IEqualityComparer<T> is used to determine if individual T's are equal

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEqualityComparer<IEnumerable<T>> GetCollectionEqualityComparer<T>(
    IEqualityComparer<T> equalityComparer
)

Public Shared Function GetCollectionEqualityComparer(Of T) ( _
    equalityComparer As IEqualityComparer(Of T) _
) As IEqualityComparer(Of IEnumerable(Of T))
public:
generic<typename T>
static IEqualityComparer<IEnumerable<T>^>^ GetCollectionEqualityComparer(
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
An IEqualityComparer<T> implementation used to compare individual T's.

Return Value

IEqualityComparer<IEnumerable<T>> implementation suitable for comparing collections of T for equality.

Examples

The following code creates a Dictionary where the keys are a collection of strings, compared in a case-insensitive way
C#
Dictionary<IEnumerable<string>, int> =
    new Dictionary<IEnumerable<string>, int>(Algorithms.GetCollectionEqualityComparer<string>(StringComparer.CurrentCultureIgnoreCase));

See Also

Algorithms Class
GetCollectionEqualityComparer Overload
Wintellect.PowerCollections Namespace
Algorithms..::..EqualCollections<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>))


GetComparerFromComparison(T) Method

Algorithms..::..GetComparerFromComparison<(Of <(<'T>)>)> Method

Given a comparison delegate that compares two items of type T, gets an IComparer<T> instance that performs the same comparison.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IComparer<T> GetComparerFromComparison<T>(
    Comparison<T> comparison
)

Public Shared Function GetComparerFromComparison(Of T) ( _
    comparison As Comparison(Of T) _
) As IComparer(Of T)
public:
generic<typename T>
static IComparer<T>^ GetComparerFromComparison(
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate to use.

Return Value

An IComparer<T> that performs the same comparing operation as comparison.

See Also

Algorithms Class


GetComparisonFromComparer(T) Method

Algorithms..::..GetComparisonFromComparer<(Of <(<'T>)>)> Method

Given in IComparer<T> instenace that comparers two items from type T, gets a Comparison delegate that performs the same comparison.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static Comparison<T> GetComparisonFromComparer<T>(
    IComparer<T> comparer
)

Public Shared Function GetComparisonFromComparer(Of T) ( _
    comparer As IComparer(Of T) _
) As Comparison(Of T)
public:
generic<typename T>
static Comparison<T>^ GetComparisonFromComparer(
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

comparer
Type: IComparer <(Of <(<'T>)>)>
The IComparer<T> instance to use.

Return Value

A Comparison<T> delegate that performans the same comparing operation as comparer.

See Also

Algorithms Class


GetCount Method

Algorithms..::..GetCount Method

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int GetCount(
    int index
)
Public Function GetCount ( _
    index As Integer _
) As Integer
public:
int^ GetCount(
    int^ index
)

Parameters

index
Type: Int32

See Also

Algorithms Class


GetDictionaryConverter Method

Algorithms..::..GetDictionaryConverter Method

Overload List

Name | Description
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to the default value (zero or null).
GetDictionaryConverter<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>), TValue) | Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.

See Also

Algorithms Class
Algorithms Members


GetDictionaryConverter(TKey, TValue) Method (IDictionary(TKey, TValue))

Algorithms..::..GetDictionaryConverter<(Of <(<'TKey, TValue>)>)> Method (IDictionary<(Of <(<'TKey, TValue>)>)>)

Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to the default value (zero or null).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(
    IDictionary<TKey, TValue> dictionary
)

Public Shared Function GetDictionaryConverter(Of TKey, TValue) ( _
    dictionary As IDictionary(Of TKey, TValue) _
) As Converter(Of TKey, TValue)
public:
generic<typename TKey, typename TValue>
static Converter<TKey, TValue>^ GetDictionaryConverter(
    IDictionary<TKey, TValue>^ dictionary
)

Type Parameters

TKey
TValue

Parameters

dictionary
Type: IDictionary <(Of <(<'TKey, TValue>)>)>
The dictionary used to perform the conversion.

Return Value

A delegate to a method that converts keys to values.

Remarks

This delegate can be used as a parameter in Convert or ConvertAll methods to convert entire collections.

See Also

Algorithms Class
GetDictionaryConverter Overload


GetDictionaryConverter(TKey, TValue) Method (IDictionary(TKey, TValue), TValue)

Algorithms..::..GetDictionaryConverter<(Of <(<'TKey, TValue>)>)> Method (IDictionary<(Of <(<'TKey, TValue>)>)>, TValue)

Creates a delegate that converts keys to values by used a dictionary to map values. Keys that a not present in the dictionary are converted to a supplied default value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static Converter<TKey, TValue> GetDictionaryConverter<TKey, TValue>(
    IDictionary<TKey, TValue> dictionary,
    TValue defaultValue
)

Public Shared Function GetDictionaryConverter(Of TKey, TValue) ( _
    dictionary As IDictionary(Of TKey, TValue), _
    defaultValue As TValue _
) As Converter(Of TKey, TValue)
public:
generic<typename TKey, typename TValue>
static Converter<TKey, TValue>^ GetDictionaryConverter(
    IDictionary<TKey, TValue>^ dictionary,
    TValue defaultValue
)

Type Parameters

TKey
TValue

Parameters

dictionary
Type: IDictionary <(Of <(<'TKey, TValue>)>)>
The dictionary used to perform the conversion.
defaultValue
Type: TValue
The result of the conversion for keys that are not present in the dictionary.

Return Value

A delegate to a method that converts keys to values.

Exceptions

Exception | Condition
ArgumentNullException | dictionary is null.

Remarks

This delegate can be used as a parameter in Convert or ConvertAll methods to convert entire collections.

See Also

Algorithms Class
GetDictionaryConverter Overload


GetIdentityComparer(T) Method

Algorithms..::..GetIdentityComparer<(Of <(<'T>)>)> Method

Gets an IEqualityComparer<T> instance that can be used to compare objects of type T for object identity only. Two objects compare equal only if they are references to the same object.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEqualityComparer<T> GetIdentityComparer<T>()

Public Shared Function GetIdentityComparer(Of T) As IEqualityComparer(Of T)
public:
generic<typename T>
static IEqualityComparer<T>^ GetIdentityComparer()

Type Parameters

T

Return Value

An IEqualityComparer<T> instance for identity comparison.

See Also

Algorithms Class


GetLexicographicalComparer Method

Algorithms..::..GetLexicographicalComparer Method

Overload List

Name | Description
GetLexicographicalComparer<(Of <<'(T>)>>)()()()() | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be used for collections or algorithms that use sequences of T as an item type. The Lexicographical ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.
GetLexicographicalComparer<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>)) | Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.

See Also

Algorithms Class
Algorithms Members


GetLexicographicalComparer(T) Method

Algorithms..::..GetLexicographicalComparer<(Of <(<'T>)>)> Method

Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be used for collections or algorithms that use sequences of T as an item type. The Lexicographical ordered of sequences is for comparison.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>()
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GetLexicographicalComparer(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) As IComparer(Of IEnumerable(Of T))
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IComparer<IEnumerable<T>^>^ GetLexicographicalComparer()

Type Parameters

T

Return Value

At IComparer<IEnumerable<T>> that compares sequences of T.

Remarks

T must implement either IComparable<T> and this implementation is used to compare the items.

See Also

Algorithms Class
GetLexicographicalComparer Overload


GetLexicographicalComparer(T) Method (IComparer(T))

Algorithms..::..GetLexicographicalComparer<(Of <(<'T>)>)> Method (IComparer<(Of <(<'T>)>)>)

Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>(
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GetLexicographicalComparer(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    comparer As IComparer(Of T) _
) As IComparer(Of IEnumerable(Of T))
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IComparer<IEnumerable<T>^>^ GetLexicographicalComparer(
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

comparer
Type: IComparer <(Of <(<'T>)>)>
A comparer instance used to compare individual items of type T.

Return Value

At IComparer<IEnumerable<T>> that compares sequences of T.

See Also

Algorithms Class
GetLexicographicalComparer Overload


GetLexicographicalComparer(T) Method (Comparison(T))

Algorithms..::..GetLexicographicalComparer<(Of <(<'T>)>)> Method (Comparison<(Of <(<'T>)>)>)

Creates an IComparer instance that can be used for comparing ordered sequences of type T; that is IEnumerable<Tgt;. This comparer can be uses for collections or algorithms that use sequences of T as an item type. The Lexicographics ordered of sequences is for comparison.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IComparer<IEnumerable<T>> GetLexicographicalComparer<T>(
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function GetLexicographicalComparer(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    comparison As Comparison(Of T) _
) As IComparer(Of IEnumerable(Of T))
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IComparer<IEnumerable<T>^>^ GetLexicographicalComparer(
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

comparison
Type: Comparison <(Of <(<'T>)>)>
A comparison delegate used to compare individual items of type T.

Return Value

At IComparer<IEnumerable<T>> that compares sequences of T.

See Also

Algorithms Class
GetLexicographicalComparer Overload


GetReverseComparer(T) Method

Algorithms..::..GetReverseComparer<(Of <(<'T>)>)> Method

Reverses the order of comparison of an IComparer<T>. The resulting comparer can be used, for example, to sort a collection in descending order. Equality and hash codes are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IComparer<T> GetReverseComparer<T>(
    IComparer<T> comparer
)

Public Shared Function GetReverseComparer(Of T) ( _
    comparer As IComparer(Of T) _
) As IComparer(Of T)
public:
generic<typename T>
static IComparer<T>^ GetReverseComparer(
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items thta are being compared.

Parameters

comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer to reverse.

Return Value

An IComparer<T> that compares items in the reverse order of comparer.

Exceptions

Exception | Condition
ArgumentNullException | comparer is null.

See Also

Algorithms Class


GetReverseComparison(T) Method

Algorithms..::..GetReverseComparison<(Of <(<'T>)>)> Method

Reverses the order of comparison of an Comparison<T>. The resulting comparison can be used, for example, to sort a collection in descending order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static Comparison<T> GetReverseComparison<T>(
    Comparison<T> comparison
)

Public Shared Function GetReverseComparison(Of T) ( _
    comparison As Comparison(Of T) _
) As Comparison(Of T)
public:
generic<typename T>
static Comparison<T>^ GetReverseComparison(
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items that are being compared.

Parameters

comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison to reverse.

Return Value

A Comparison<T> that compares items in the reverse order of comparison.

Exceptions

Exception | Condition
ArgumentNullException | comparison is null.

See Also

Algorithms Class


GetSetEqualityComparer Method

Algorithms..::..GetSetEqualityComparer Method

Overload List

Name | Description
GetSetEqualityComparer<(Of <<'(T>)>>)()()()() | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation. An IEqualityComparer<T> is used to determine if individual T's are equal
GetSetEqualityComparer<(Of <<'(T>)>>)(IEqualityComparer<(Of <<'(T>)>>)) | Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.

See Also

Algorithms Class
Algorithms Members


GetSetEqualityComparer(T) Method

Algorithms..::..GetSetEqualityComparer<(Of <(<'T>)>)> Method

Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.

An IEqualityComparer<T> is used to determine if individual T's are equal

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEqualityComparer<IEnumerable<T>> GetSetEqualityComparer<T>()

Public Shared Function GetSetEqualityComparer(Of T) As IEqualityComparer(Of IEnumerable(Of T))
public:
generic<typename T>
static IEqualityComparer<IEnumerable<T>^>^ GetSetEqualityComparer()

Type Parameters

T

Return Value

IEqualityComparer<IEnumerable<T>> implementation suitable for comparing collections of T for equality, without regard to order.

Examples

The following code creates a Dictionary where the keys are a set of strings, without regard to order
C#
Dictionary<IEnumerable<string>, int> =
    new Dictionary<IEnumerable<string>, int>(Algorithms.GetSetEqualityComparer<string>(StringComparer.CurrentCultureIgnoreCase));

See Also

Algorithms Class
GetSetEqualityComparer Overload
Wintellect.PowerCollections Namespace
Algorithms..::..EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>))


GetSetEqualityComparer(T) Method (IEqualityComparer(T))

Algorithms..::..GetSetEqualityComparer<(Of <(<'T>)>)> Method (IEqualityComparer<(Of <(<'T>)>)>)

Gets an IEqualityComparer<IEnumerable<T>> implementation that can be used to compare collections of elements (of type T). Two collections of T's are equal if they have the same number of items, and corresponding items are equal, without regard to order. This is the same notion of equality as in Algorithms.EqualSets, but encapsulated in an IEqualityComparer<IEnumerable<T>> implementation.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEqualityComparer<IEnumerable<T>> GetSetEqualityComparer<T>(
    IEqualityComparer<T> equalityComparer
)

Public Shared Function GetSetEqualityComparer(Of T) ( _
    equalityComparer As IEqualityComparer(Of T) _
) As IEqualityComparer(Of IEnumerable(Of T))
public:
generic<typename T>
static IEqualityComparer<IEnumerable<T>^>^ GetSetEqualityComparer(
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
An IEqualityComparer<T> implementation used to compare individual T's.

Return Value

IEqualityComparer<IEnumerable<T>> implementation suitable for comparing collections of T for equality, without regard to order.

Examples

The following code creates a Dictionary where the keys are a set of strings, without regard to order
C#
Dictionary<IEnumerable<string>, int> =
    new Dictionary<IEnumerable<string>, int>(Algorithms.GetSetEqualityComparer<string>());

See Also

Algorithms Class
GetSetEqualityComparer Overload
Wintellect.PowerCollections Namespace
Algorithms..::..EqualSets<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>))


IndexOfMaximum Method

Algorithms..::..IndexOfMaximum Method

Overload List

Name | Description
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMaximum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


IndexOfMaximum(T) Method (IList(T))

Algorithms..::..IndexOfMaximum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Finds the index of the maximum value in a list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMaximum<T>(
    IList<T> list
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMaximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMaximum(
    IList<T>^ list
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.

Return Value

The index of the largest item in the list. If the maximum value appears multiple times, the index of the first appearance is used. If the list is empty, -1 is returned.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

Values in the list are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
IndexOfMaximum Overload


IndexOfMaximum(T) Method (IList(T), IComparer(T))

Algorithms..::..IndexOfMaximum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Finds the index of the maximum value in a list. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMaximum<T>(
    IList<T> list,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMaximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparer As IComparer(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMaximum(
    IList<T>^ list,
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection.

Return Value

The index of the largest item in the list. If the maximum value appears multiple times, the index of the first appearance is used. If the list is empty, -1 is returned.

Exceptions

Exception | Condition
ArgumentNullException | list or comparer is null.

See Also

Algorithms Class
IndexOfMaximum Overload


IndexOfMaximum(T) Method (IList(T), Comparison(T))

Algorithms..::..IndexOfMaximum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMaximum<T>(
    IList<T> list,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMaximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparison As Comparison(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMaximum(
    IList<T>^ list,
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison used to compare items in the collection.

Return Value

The index of the largest item in the list. If the maximum value appears multiple times, the index of the first appearance is used. If the list is empty, -1 is returned.

Exceptions

Exception | Condition
ArgumentNullException | list or comparison is null.

See Also

Algorithms Class
IndexOfMaximum Overload


IndexOfMinimum Method

Algorithms..::..IndexOfMinimum Method

Overload List

Name | Description
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
IndexOfMinimum<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the index of the minimum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


IndexOfMinimum(T) Method (IList(T))

Algorithms..::..IndexOfMinimum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Finds the index of the minimum value in a list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMinimum<T>(
    IList<T> list
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMinimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMinimum(
    IList<T>^ list
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.

Return Value

The index of the smallest item in the list. If the minimum value appears multiple times, the index of the first appearance is used.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | list is null.

Remarks

Values in the list are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
IndexOfMinimum Overload


IndexOfMinimum(T) Method (IList(T), IComparer(T))

Algorithms..::..IndexOfMinimum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Finds the index of the minimum value in a list. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMinimum<T>(
    IList<T> list,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMinimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparer As IComparer(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMinimum(
    IList<T>^ list,
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection.

Return Value

The index of the smallest item in the list. If the minimum value appears multiple times, the index of the first appearance is used.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | list or comparer is null.

See Also

Algorithms Class
IndexOfMinimum Overload


IndexOfMinimum(T) Method (IList(T), Comparison(T))

Algorithms..::..IndexOfMinimum<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Finds the index of the minimum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int IndexOfMinimum<T>(
    IList<T> list,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function IndexOfMinimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparison As Comparison(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ IndexOfMinimum(
    IList<T>^ list,
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to compare items in the collection.

Return Value

The index of the smallest item in the list. If the minimum value appears multiple times, the index of the first appearance is used.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | list or comparison is null.

See Also

Algorithms Class
IndexOfMinimum Overload


IndicesOf Method

Algorithms..::..IndicesOf Method

Overload List

Name | Description
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Enumerates the indices of all the items in a list equal to a given item.
IndicesOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

See Also

Algorithms Class
Algorithms Members


IndicesOf(T) Method (IList(T), T)

Algorithms..::..IndicesOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T)

Enumerates the indices of all the items in a list equal to a given item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> IndicesOf<T>(
    IList<T> list,
    T item
)

Public Shared Function IndicesOf(Of T) ( _
    list As IList(Of T), _
    item As T _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ IndicesOf(
    IList<T>^ list,
    T item
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.

Return Value

An IEnumerable<T> that enumerates the indices of items equal to item.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
IndicesOf Overload


IndicesOf(T) Method (IList(T), T, IEqualityComparer(T))

Algorithms..::..IndicesOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, IEqualityComparer<(Of <(<'T>)>)>)

Enumerates the indices of all the items in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> IndicesOf<T>(
    IList<T> list,
    T item,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function IndicesOf(Of T) ( _
    list As IList(Of T), _
    item As T, _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ IndicesOf(
    IList<T>^ list,
    T item,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

An IEnumerable<T> that enumerates the indices of items equal to item.

See Also

Algorithms Class
IndicesOf Overload


IndicesOfMany Method

Algorithms..::..IndicesOfMany Method

Overload List

Name | Description
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
IndicesOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Enumerates the indices of all the items in a list equal to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


IndicesOfMany(T) Method (IList(T), IEnumerable(T))

Algorithms..::..IndicesOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Enumerates the indices of all the items in a list equal to one of several given items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> IndicesOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor
)

Public Shared Function IndicesOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T) _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ IndicesOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
A collection of items to search for.

Return Value

An IEnumerable<T> that enumerates the indices of items equal to any of the items in the collection itemsToLookFor.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
IndicesOfMany Overload


IndicesOfMany(T) Method (IList(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..IndicesOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Enumerates the indices of all the items in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> IndicesOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function IndicesOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ IndicesOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
A collection of items to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality.

Return Value

An IEnumerable<T> that enumerates the indices of items equal to any of the items in the collection itemsToLookFor.

See Also

Algorithms Class
IndicesOfMany Overload


IndicesOfMany(T) Method (IList(T), IEnumerable(T), BinaryPredicate(T))

Algorithms..::..IndicesOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Enumerates the indices of all the items in a list equal to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<int> IndicesOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    BinaryPredicate<T> predicate
)

Public Shared Function IndicesOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As IEnumerable(Of Integer)
public:
generic<typename T>
static IEnumerable<int^>^ IndicesOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
A collection of items to search for.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Return Value

An IEnumerable<T> that enumerates the indices of items "equal" to any of the items in the collection itemsToLookFor, using BinaryPredicate as the test for equality.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being removed need not be true equality. This methods finds last item X which satisfies BinaryPredicate(X,Y), where Y is one of the items in itemsToLookFor

See Also

Algorithms Class
IndicesOfMany Overload


IsProperSubsetOf Method

Algorithms..::..IsProperSubsetOf Method

Overload List

Name | Description
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsProperSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

See Also

Algorithms Class
Algorithms Members


IsProperSubsetOf(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..IsProperSubsetOf<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool IsProperSubsetOf<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function IsProperSubsetOf(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ IsProperSubsetOf(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.

Return Value

True if collection1 is a subset of collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsSubsetOf method on that class.

See Also

Algorithms Class
IsProperSubsetOf Overload


IsProperSubsetOf(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..IsProperSubsetOf<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Determines if one collection is a proper subset of another, considered as sets. The first set is a proper subset of the second set if every item in the first set also occurs in the second set, and the first set is strictly smaller than the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool IsProperSubsetOf<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function IsProperSubsetOf(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ IsProperSubsetOf(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

True if collection1 is a proper subset of collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsSubsetOf method on that class.

See Also

Algorithms Class
IsProperSubsetOf Overload


IsSubsetOf Method

Algorithms..::..IsSubsetOf Method

Overload List

Name | Description
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.
IsSubsetOf<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

See Also

Algorithms Class
Algorithms Members


IsSubsetOf(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..IsSubsetOf<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool IsSubsetOf<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function IsSubsetOf(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ IsSubsetOf(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.

Return Value

True if collection1 is a subset of collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsSubsetOf method on that class.

See Also

Algorithms Class
IsSubsetOf Overload


IsSubsetOf(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..IsSubsetOf<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Determines if one collection is a subset of another, considered as sets. The first set is a subset of the second set if every item in the first set also occurs in the second set. If an item appears X times in the first set, it must appear at least X times in the second set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool IsSubsetOf<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function IsSubsetOf(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ IsSubsetOf(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality.

Return Value

True if collection1 is a subset of collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the IsSubsetOf method on that class.

See Also

Algorithms Class
IsSubsetOf Overload


LastIndexOf Method

Algorithms..::..LastIndexOf Method

Overload List

Name | Description
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T) | Finds the index of the last item in a list equal to a given item.
LastIndexOf<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

See Also

Algorithms Class
Algorithms Members


LastIndexOf(T) Method (IList(T), T)

Algorithms..::..LastIndexOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T)

Finds the index of the last item in a list equal to a given item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LastIndexOf<T>(
    IList<T> list,
    T item
)

Public Shared Function LastIndexOf(Of T) ( _
    list As IList(Of T), _
    item As T _
) As Integer
public:
generic<typename T>
static int^ LastIndexOf(
    IList<T>^ list,
    T item
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.

Return Value

The index of the last item equal to item. -1 if no such item exists in the list.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
LastIndexOf Overload


LastIndexOf(T) Method (IList(T), T, IEqualityComparer(T))

Algorithms..::..LastIndexOf<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, IEqualityComparer<(Of <(<'T>)>)>)

Finds the index of the last item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LastIndexOf<T>(
    IList<T> list,
    T item,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function LastIndexOf(Of T) ( _
    list As IList(Of T), _
    item As T, _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ LastIndexOf(
    IList<T>^ list,
    T item,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
item
Type: T
The item to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

The index of the last item equal to item. -1 if no such item exists in the list.

See Also

Algorithms Class
LastIndexOf Overload


LastIndexOfMany Method

Algorithms..::..LastIndexOfMany Method

Overload List

Name | Description
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Finds the index of the last item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.
LastIndexOfMany<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Finds the index of the last item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


LastIndexOfMany(T) Method (IList(T), IEnumerable(T))

Algorithms..::..LastIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Finds the index of the last item in a list equal to one of several given items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LastIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor
)

Public Shared Function LastIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
static int^ LastIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.

Return Value

The index of the last item equal to any of the items in the collection itemsToLookFor. -1 if no such item exists in the list.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
LastIndexOfMany Overload


LastIndexOfMany(T) Method (IList(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..LastIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Finds the index of the last item in a list equal to one of several given items. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LastIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function LastIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ LastIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality.

Return Value

The index of the last item equal to any of the items in the collection itemsToLookFor. -1 if no such item exists in the list.

See Also

Algorithms Class
LastIndexOfMany Overload


LastIndexOfMany(T) Method (IList(T), IEnumerable(T), BinaryPredicate(T))

Algorithms..::..LastIndexOfMany<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Finds the index of the last item in a list "equal" to one of several given items. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LastIndexOfMany<T>(
    IList<T> list,
    IEnumerable<T> itemsToLookFor,
    BinaryPredicate<T> predicate
)

Public Shared Function LastIndexOfMany(Of T) ( _
    list As IList(Of T), _
    itemsToLookFor As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ LastIndexOfMany(
    IList<T>^ list,
    IEnumerable<T>^ itemsToLookFor,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
itemsToLookFor
Type: IEnumerable <(Of <(<'T>)>)>
The items to search for.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Return Value

The index of the last item "equal" to any of the items in the collection itemsToLookFor, using BinaryPredicate as the test for equality. -1 if no such item exists in the list.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being removed need not be true equality. This methods finds last item X which satisfies BinaryPredicate(X,Y), where Y is one of the items in itemsToLookFor

See Also

Algorithms Class
LastIndexOfMany Overload


LexicographicalCompare Method

Algorithms..::..LexicographicalCompare Method

Overload List

Name | Description
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparison delegate. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.
LexicographicalCompare<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Performs a lexicographical comparison of two sequences of values, using a supplied comparer interface. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.

See Also

Algorithms Class
Algorithms Members


LexicographicalCompare(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..LexicographicalCompare<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Performs a lexicographical comparison of two sequences of values. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LexicographicalCompare<T>(
    IEnumerable<T> sequence1,
    IEnumerable<T> sequence2
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function LexicographicalCompare(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    sequence1 As IEnumerable(Of T), _
    sequence2 As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ LexicographicalCompare(
    IEnumerable<T>^ sequence1,
    IEnumerable<T>^ sequence2
)

Type Parameters

T
Types of items to compare. This type must implement IComparable<T> to allow items to be compared.

Parameters

sequence1
Type: IEnumerable <(Of <(<'T>)>)>
The first sequence to compare.
sequence2
Type: IEnumerable <(Of <(<'T>)>)>
The second sequence to compare.

Return Value

Less than zero if sequence1 is lexicographically less than sequence2. Greater than zero if sequence1 is lexicographically greater than sequence2. Zero if sequence1 is equal to sequence2.

Exceptions

Exception | Condition
NotSupportedException | T does not implement IComparable<T> or IComparable.

Remarks

T must implement either IComparable<T> and this implementation is used to compare the items.

See Also

Algorithms Class
LexicographicalCompare Overload


LexicographicalCompare(T) Method (IEnumerable(T), IEnumerable(T), Comparison(T))

Algorithms..::..LexicographicalCompare<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Performs a lexicographical comparison of two sequences of values, using a supplied comparison delegate. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LexicographicalCompare<T>(
    IEnumerable<T> sequence1,
    IEnumerable<T> sequence2,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function LexicographicalCompare(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    sequence1 As IEnumerable(Of T), _
    sequence2 As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ LexicographicalCompare(
    IEnumerable<T>^ sequence1,
    IEnumerable<T>^ sequence2,
    Comparison<T>^ comparison
)

Type Parameters

T
Types of items to compare.

Parameters

sequence1
Type: IEnumerable <(Of <(<'T>)>)>
The first sequence to compare.
sequence2
Type: IEnumerable <(Of <(<'T>)>)>
The second sequence to compare.
comparison
Type: Comparison <(Of <(<'T>)>)>
The IComparison<T> delegate to compare items. Only the Compare member function of this interface is called.

Return Value

Less than zero if sequence1 is lexicographically less than sequence2. Greater than zero if sequence1 is lexicographically greater than sequence2. Zero if sequence1 is equal to sequence2.

See Also

Algorithms Class
LexicographicalCompare Overload


LexicographicalCompare(T) Method (IEnumerable(T), IEnumerable(T), IComparer(T))

Algorithms..::..LexicographicalCompare<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Performs a lexicographical comparison of two sequences of values, using a supplied comparer interface. A lexicographical comparison compares corresponding pairs of elements from two sequences in order. If the first element of sequence1 is less than the first element of sequence2, then the comparison ends and the first sequence is lexicographically less than the second. If the first elements of each sequence are equal, then the comparison proceeds to the second element of each sequence. If one sequence is shorter than the other, but corresponding elements are all equal, then the shorter sequence is considered less than the longer one.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int LexicographicalCompare<T>(
    IEnumerable<T> sequence1,
    IEnumerable<T> sequence2,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function LexicographicalCompare(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    sequence1 As IEnumerable(Of T), _
    sequence2 As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As Integer
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static int^ LexicographicalCompare(
    IEnumerable<T>^ sequence1,
    IEnumerable<T>^ sequence2,
    IComparer<T>^ comparer
)

Type Parameters

T
Types of items to compare.

Parameters

sequence1
Type: IEnumerable <(Of <(<'T>)>)>
The first sequence to compare.
sequence2
Type: IEnumerable <(Of <(<'T>)>)>
The second sequence to compare.
comparer
Type: IComparer <(Of <(<'T>)>)>
The IComparer<T> used to compare items. Only the Compare member function of this interface is called.

Return Value

Less than zero if sequence1 is lexicographically less than sequence2. Greater than zero if sequence1 is lexicographically greater than sequence2. Zero if sequence1 is equal to sequence2.

Exceptions

Exception | Condition
ArgumentNullException | sequence1, sequence2, or comparer is null.

See Also

Algorithms Class
LexicographicalCompare Overload


Maximum Method

Algorithms..::..Maximum Method

Overload List

Name | Description
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the maximum value in a collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Maximum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


Maximum(T) Method (IEnumerable(T))

Algorithms..::..Maximum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Finds the maximum value in a collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Maximum<T>(
    IEnumerable<T> collection
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Maximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Maximum(
    IEnumerable<T>^ collection
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.

Return Value

The largest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection is null.

Remarks

Values in the collection are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
Maximum Overload


Maximum(T) Method (IEnumerable(T), IComparer(T))

Algorithms..::..Maximum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Maximum<T>(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Maximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Maximum(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection.

Return Value

The largest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection or comparer is null.

See Also

Algorithms Class
Maximum Overload


Maximum(T) Method (IEnumerable(T), Comparison(T))

Algorithms..::..Maximum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Maximum<T>(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Maximum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Maximum(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison used to compare items in the collection.

Return Value

The largest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection or comparison is null.

See Also

Algorithms Class
Maximum Overload


MergeSorted Method

Algorithms..::..MergeSorted Method

Overload List

Name | Description
MergeSorted<(Of <<'(T>)>>)(array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the natural ordering of the type (it's implementation of IComparable<T>). The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(IComparer<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed instance of IComparer<T>. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.
MergeSorted<(Of <<'(T>)>>)(Comparison<(Of <<'(T>)>>), array<IEnumerable<(Of <<'(T>)>>)>[]()[][]) | Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed Comparison<T> delegate. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.

See Also

Algorithms Class
Algorithms Members


MergeSorted(T) Method (IEnumerable(T)[])

Algorithms..::..MergeSorted<(Of <(<'T>)>)> Method (array<IEnumerable<(Of <(<'T>)>)>>[]()[][])

Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the natural ordering of the type (it's implementation of IComparable<T>). The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> MergeSorted<T>(
    params IEnumerable<T>[] collections
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function MergeSorted(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    ParamArray collections As IEnumerable(Of T)() _
) As IEnumerable(Of T)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<T>^ MergeSorted(
    ... array<IEnumerable<T>^>^ collections
)

Type Parameters

T

Parameters

collections
Type: array<IEnumerable<(Of <(<'T>)>)>>[]()[][]
The set of collections to merge. In many languages, this parameter can be specified as several individual parameters.

Return Value

An IEnumerable<T> that enumerates all the items in all the collections in sorted order.

See Also

Algorithms Class
MergeSorted Overload


MergeSorted(T) Method (IComparer(T), IEnumerable(T)[])

Algorithms..::..MergeSorted<(Of <(<'T>)>)> Method (IComparer<(Of <(<'T>)>)>, array<IEnumerable<(Of <(<'T>)>)>>[]()[][])

Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed instance of IComparer<T>. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> MergeSorted<T>(
    IComparer<T> comparer,
    params IEnumerable<T>[] collections
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function MergeSorted(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    comparer As IComparer(Of T), _
    ParamArray collections As IEnumerable(Of T)() _
) As IEnumerable(Of T)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<T>^ MergeSorted(
    IComparer<T>^ comparer,
    ... array<IEnumerable<T>^>^ collections
)

Type Parameters

T

Parameters

comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to sort the list. Only the Compare method is used.
collections
Type: array<IEnumerable<(Of <(<'T>)>)>>[]()[][]
The set of collections to merge. In many languages, this parameter can be specified as several individual parameters.

Return Value

An IEnumerable<T> that enumerates all the items in all the collections in sorted order.

See Also

Algorithms Class
MergeSorted Overload


MergeSorted(T) Method (Comparison(T), IEnumerable(T)[])

Algorithms..::..MergeSorted<(Of <(<'T>)>)> Method (Comparison<(Of <(<'T>)>)>, array<IEnumerable<(Of <(<'T>)>)>>[]()[][])

Merge several sorted collections into a single sorted collection. Each input collection must be sorted by the ordering in the passed Comparison<T> delegate. The merging is stable; equal items maintain their ordering, and equal items in different collections are placed in the order of the collections.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> MergeSorted<T>(
    Comparison<T> comparison,
    params IEnumerable<T>[] collections
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function MergeSorted(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    comparison As Comparison(Of T), _
    ParamArray collections As IEnumerable(Of T)() _
) As IEnumerable(Of T)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static IEnumerable<T>^ MergeSorted(
    Comparison<T>^ comparison,
    ... array<IEnumerable<T>^>^ collections
)

Type Parameters

T

Parameters

comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to sort the collections.
collections
Type: array<IEnumerable<(Of <(<'T>)>)>>[]()[][]
The set of collections to merge. In many languages, this parameter can be specified as several individual parameters.

Return Value

An IEnumerable<T> that enumerates all the items in all the collections in sorted order.

See Also

Algorithms Class
MergeSorted Overload


Minimum Method

Algorithms..::..Minimum Method

Overload List

Name | Description
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Finds the minimum value in a collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Minimum<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Finds the minimum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


Minimum(T) Method (IEnumerable(T))

Algorithms..::..Minimum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Finds the minimum value in a collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Minimum<T>(
    IEnumerable<T> collection
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Minimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Minimum(
    IEnumerable<T>^ collection
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.

Return Value

The smallest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection is null.

Remarks

Values in the collection are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
Minimum Overload


Minimum(T) Method (IEnumerable(T), IComparer(T))

Algorithms..::..Minimum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Finds the minimum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Minimum<T>(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Minimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Minimum(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection.

Return Value

The smallest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection or comparer is null.

See Also

Algorithms Class
Minimum Overload


Minimum(T) Method (IEnumerable(T), Comparison(T))

Algorithms..::..Minimum<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Finds the minimum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T Minimum<T>(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Minimum(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As T
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static T Minimum(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison used to compare items in the collection.

Return Value

The smallest item in the collection.

Exceptions

Exception | Condition
InvalidOperationException | The collection is empty.
ArgumentNullException | collection or comparison is null.

See Also

Algorithms Class
Minimum Overload


NCopiesOf(T) Method

Algorithms..::..NCopiesOf<(Of <(<'T>)>)> Method

Creates an IEnumerator that enumerates a given item n times.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> NCopiesOf<T>(
    int n,
    T item
)

Public Shared Function NCopiesOf(Of T) ( _
    n As Integer, _
    item As T _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ NCopiesOf(
    int^ n,
    T item
)

Type Parameters

T

Parameters

n
Type: Int32
The number of times to enumerate the item.
item
Type: T
The item that should occur in the enumeration.

Return Value

An IEnumerable<T> that yields n copies of item.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The argument n is less than zero.

Examples

The following creates a list consisting of 1000 copies of the double 1.0.
C#
List<double> list = new List<double>(Algorithms.NCopiesOf(1000, 1.0));

See Also

Algorithms Class


Partition(T) Method

Algorithms..::..Partition<(Of <(<'T>)>)> Method

Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int Partition<T>(
    IList<T> list,
    Predicate<T> predicate
)

Public Shared Function Partition(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ Partition(
    IList<T>^ list,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to partition.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the partitioning condition.

Return Value

The index of the first item in the second half of the partition; i.e., the first item for which predicate returned false. If the predicate was true for all items in the list, list.Count is returned.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class


RandomShuffle Method

Algorithms..::..RandomShuffle Method

Overload List

Name | Description
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Randomly shuffles the items in a collection, yielding a new collection.
RandomShuffle<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a collection, yielding a new collection.

See Also

Algorithms Class
Algorithms Members


RandomShuffle(T) Method (IEnumerable(T))

Algorithms..::..RandomShuffle<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Randomly shuffles the items in a collection, yielding a new collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] RandomShuffle<T>(
    IEnumerable<T> collection
)

Public Shared Function RandomShuffle(Of T) ( _
    collection As IEnumerable(Of T) _
) As T()
public:
generic<typename T>
static array<T>^ RandomShuffle(
    IEnumerable<T>^ collection
)

Type Parameters

T
The type of the items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to shuffle.

Return Value

An array with the same size and items as collection, but the items in a randomly chosen order.

See Also

Algorithms Class
RandomShuffle Overload


RandomShuffle(T) Method (IEnumerable(T), Random)

Algorithms..::..RandomShuffle<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Random)

Randomly shuffles the items in a collection, yielding a new collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] RandomShuffle<T>(
    IEnumerable<T> collection,
    Random randomGenerator
)

Public Shared Function RandomShuffle(Of T) ( _
    collection As IEnumerable(Of T), _
    randomGenerator As Random _
) As T()
public:
generic<typename T>
static array<T>^ RandomShuffle(
    IEnumerable<T>^ collection,
    Random^ randomGenerator
)

Type Parameters

T
The type of the items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to shuffle.
randomGenerator
Type: Random
The random number generator to use to select the random order.

Return Value

An array with the same size and items as collection, but the items in a randomly chosen order.

See Also

Algorithms Class
RandomShuffle Overload


RandomShuffleInPlace Method

Algorithms..::..RandomShuffleInPlace Method

Overload List

Name | Description
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Randomly shuffles the items in a list or array, in place.
RandomShuffleInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Random) | Randomly shuffles the items in a list or array, in place.

See Also

Algorithms Class
Algorithms Members


RandomShuffleInPlace(T) Method (IList(T))

Algorithms..::..RandomShuffleInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Randomly shuffles the items in a list or array, in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RandomShuffleInPlace<T>(
    IList<T> list
)

Public Shared Sub RandomShuffleInPlace(Of T) ( _
    list As IList(Of T) _
)
public:
generic<typename T>
static void RandomShuffleInPlace(
    IList<T>^ list
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to shuffle.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
RandomShuffleInPlace Overload


RandomShuffleInPlace(T) Method (IList(T), Random)

Algorithms..::..RandomShuffleInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Random)

Randomly shuffles the items in a list or array, in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RandomShuffleInPlace<T>(
    IList<T> list,
    Random randomGenerator
)

Public Shared Sub RandomShuffleInPlace(Of T) ( _
    list As IList(Of T), _
    randomGenerator As Random _
)
public:
generic<typename T>
static void RandomShuffleInPlace(
    IList<T>^ list,
    Random^ randomGenerator
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to shuffle.
randomGenerator
Type: Random
The random number generator to use to select the random order.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
RandomShuffleInPlace Overload


RandomSubset Method

Algorithms..::..RandomSubset Method

Overload List

Name | Description
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.
RandomSubset<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Int32, Random) | Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.

See Also

Algorithms Class
Algorithms Members


RandomSubset(T) Method (IEnumerable(T), Int32)

Algorithms..::..RandomSubset<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Int32)

Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] RandomSubset<T>(
    IEnumerable<T> collection,
    int count
)

Public Shared Function RandomSubset(Of T) ( _
    collection As IEnumerable(Of T), _
    count As Integer _
) As T()
public:
generic<typename T>
static array<T>^ RandomSubset(
    IEnumerable<T>^ collection,
    int^ count
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to select from. This collection is not changed.
count
Type: Int32
The number of items in the subset to choose.

Return Value

An array of count items, selected at random from collection.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | count is negative or greater than collection.Count.

Remarks

If the collection implements IList<T>, then this method takes time O(count). Otherwise, this method takes time O(N), where N is the number of items in the collection.

See Also

Algorithms Class
RandomSubset Overload


RandomSubset(T) Method (IEnumerable(T), Int32, Random)

Algorithms..::..RandomSubset<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Int32, Random)

Picks a random subset of count items from collection, and places those items into a random order. No item is selected more than once.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] RandomSubset<T>(
    IEnumerable<T> collection,
    int count,
    Random randomGenerator
)

Public Shared Function RandomSubset(Of T) ( _
    collection As IEnumerable(Of T), _
    count As Integer, _
    randomGenerator As Random _
) As T()
public:
generic<typename T>
static array<T>^ RandomSubset(
    IEnumerable<T>^ collection,
    int^ count,
    Random^ randomGenerator
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection of items to select from. This collection is not changed.
count
Type: Int32
The number of items in the subset to choose.
randomGenerator
Type: Random
The random number generates used to make the selection.

Return Value

An array of count items, selected at random from collection.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | count is negative or greater than list.Count.
ArgumentNullException | randomGenerator is null.

Remarks

If the collection implements IList<T>, then this method takes time O(count). Otherwise, this method takes time O(N), where N is the number of items in the collection.

See Also

Algorithms Class
RandomSubset Overload


Range Method

Algorithms..::..Range Method

Overload List

Name | Description
Range<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Int32, Int32) | Returns a view onto a sub-range of a list. Items from list are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Range<(Of <<'(T>)>>)(array<T>[]()[][], Int32, Int32) | Returns a view onto a sub-range of an array. Items from array are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to array are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view. After an insertion, the last item in array "falls off the end". After a deletion, the last item in array becomes the default value (0 or null).

See Also

Algorithms Class
Algorithms Members


Range(T) Method (IList(T), Int32, Int32)

Algorithms..::..Range<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Int32, Int32)

Returns a view onto a sub-range of a list. Items from list are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList<T> Range<T>(
    IList<T> list,
    int start,
    int count
)

Public Shared Function Range(Of T) ( _
    list As IList(Of T), _
    start As Integer, _
    count As Integer _
) As IList(Of T)
public:
generic<typename T>
static IList<T>^ Range(
    IList<T>^ list,
    int^ start,
    int^ count
)

Type Parameters

T
The type of the items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to view.
start
Type: Int32
The starting index of the view.
count
Type: Int32
The number of items in the view.

Return Value

A list that is a view onto the given sub-list.

Exceptions

Exception | Condition
ArgumentNullException | list is null.
ArgumentOutOfRangeException | start or count is negative.
ArgumentOutOfRangeException | start + count is greater than the size of list.

Remarks

This method can be used to apply an algorithm to a portion of a list. For example:
C#
Algorithms.ReverseInPlace(Algorithms.Range(list, 3, 6))
 will reverse the 6 items beginning at index 3.

See Also

Algorithms Class
Range Overload


Range(T) Method (T[], Int32, Int32)

Algorithms..::..Range<(Of <(<'T>)>)> Method (array<T>[]()[][], Int32, Int32)

Returns a view onto a sub-range of an array. Items from array are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to array are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view. After an insertion, the last item in array "falls off the end". After a deletion, the last item in array becomes the default value (0 or null).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList<T> Range<T>(
    T[] array,
    int start,
    int count
)

Public Shared Function Range(Of T) ( _
    array As T(), _
    start As Integer, _
    count As Integer _
) As IList(Of T)
public:
generic<typename T>
static IList<T>^ Range(
    array<T>^ array,
    int^ start,
    int^ count
)

Type Parameters

T

Parameters

array
Type: array<T>[]()[][]
The array to view.
start
Type: Int32
The starting index of the view.
count
Type: Int32
The number of items in the view.

Return Value

A list that is a view onto the given sub-array.

Exceptions

Exception | Condition
ArgumentNullException | array is null.
ArgumentOutOfRangeException | start or count is negative.
ArgumentOutOfRangeException | start + count is greater than the size of array.

Remarks

This method can be used to apply an algorithm to a portion of a array. For example:
C#
Algorithms.ReverseInPlace(Algorithms.Range(array, 3, 6))
 will reverse the 6 items beginning at index 3.

See Also

Algorithms Class
Range Overload


ReadOnly Method

Algorithms..::..ReadOnly Method

Overload List

Name | Description
ReadOnly<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Returns a read-only view onto a collection. The returned ICollection<T> interface only allows operations that do not change the collection: GetEnumerator, Contains, CopyTo, Count. The ReadOnly property returns false, indicating that the collection is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Returns a read-only view onto a list. The returned IList<T> interface only allows operations that do not change the list: GetEnumerator, Contains, CopyTo, Count, IndexOf, and the get accessor of the indexer. The IsReadOnly property returns true, indicating that the list is read-only. All other methods on the interface throw a NotSupportedException.
ReadOnly<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Returns a read-only view onto a dictionary. The returned IDictionary<TKey,TValue> interface only allows operations that do not change the dictionary. The IsReadOnly property returns true, indicating that the dictionary is read-only. All other methods on the interface throw a NotSupportedException.

See Also

Algorithms Class
Algorithms Members


ReadOnly(T) Method (ICollection(T))

Algorithms..::..ReadOnly<(Of <(<'T>)>)> Method (ICollection<(Of <(<'T>)>)>)

Returns a read-only view onto a collection. The returned ICollection<T> interface only allows operations that do not change the collection: GetEnumerator, Contains, CopyTo, Count. The ReadOnly property returns false, indicating that the collection is read-only. All other methods on the interface throw a NotSupportedException.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static ICollection<T> ReadOnly<T>(
    ICollection<T> collection
)

Public Shared Function ReadOnly(Of T) ( _
    collection As ICollection(Of T) _
) As ICollection(Of T)
public:
generic<typename T>
static ICollection<T>^ ReadOnly(
    ICollection<T>^ collection
)

Type Parameters

T
The type of items in the collection.

Parameters

collection
Type: ICollection <(Of <(<'T>)>)>
The collection to wrap.

Return Value

A read-only view onto collection. If collection is null, then null is returned.

Remarks

The data in the underlying collection is not copied. If the underlying collection is changed, then the read-only view also changes accordingly.

See Also

Algorithms Class
ReadOnly Overload


ReadOnly(T) Method (IList(T))

Algorithms..::..ReadOnly<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Returns a read-only view onto a list. The returned IList<T> interface only allows operations that do not change the list: GetEnumerator, Contains, CopyTo, Count, IndexOf, and the get accessor of the indexer. The IsReadOnly property returns true, indicating that the list is read-only. All other methods on the interface throw a NotSupportedException.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList<T> ReadOnly<T>(
    IList<T> list
)

Public Shared Function ReadOnly(Of T) ( _
    list As IList(Of T) _
) As IList(Of T)
public:
generic<typename T>
static IList<T>^ ReadOnly(
    IList<T>^ list
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to wrap.

Return Value

A read-only view onto list. Returns null if list is null. If list is already read-only, returns list.

Remarks

The data in the underlying list is not copied. If the underlying list is changed, then the read-only view also changes accordingly.

See Also

Algorithms Class
ReadOnly Overload


ReadOnly(TKey, TValue) Method (IDictionary(TKey, TValue))

Algorithms..::..ReadOnly<(Of <(<'TKey, TValue>)>)> Method (IDictionary<(Of <(<'TKey, TValue>)>)>)

Returns a read-only view onto a dictionary. The returned IDictionary<TKey,TValue> interface only allows operations that do not change the dictionary. The IsReadOnly property returns true, indicating that the dictionary is read-only. All other methods on the interface throw a NotSupportedException.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IDictionary<TKey, TValue> ReadOnly<TKey, TValue>(
    IDictionary<TKey, TValue> dictionary
)

Public Shared Function ReadOnly(Of TKey, TValue) ( _
    dictionary As IDictionary(Of TKey, TValue) _
) As IDictionary(Of TKey, TValue)
public:
generic<typename TKey, typename TValue>
static IDictionary<TKey, TValue>^ ReadOnly(
    IDictionary<TKey, TValue>^ dictionary
)

Type Parameters

TKey
TValue

Parameters

dictionary
Type: IDictionary <(Of <(<'TKey, TValue>)>)>
The dictionary to wrap.

Return Value

A read-only view onto dictionary. Returns null if dictionary is null. If dictionary is already read-only, returns dictionary.

Remarks

The data in the underlying dictionary is not copied. If the underlying dictionary is changed, then the read-only view also changes accordingly.

See Also

Algorithms Class
ReadOnly Overload


ReadWriteList(T) Method

Algorithms..::..ReadWriteList<(Of <(<'T>)>)> Method

Reads the write list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList<T> ReadWriteList<T>(
    T[] array,
    int sfggd
)

Public Shared Function ReadWriteList(Of T) ( _
    array As T(), _
    sfggd As Integer _
) As IList(Of T)
public:
generic<typename T>
static IList<T>^ ReadWriteList(
    array<T>^ array,
    int^ sfggd
)

Type Parameters

T

Parameters

array
Type: array<T>[]()[][]
sfggd
Type: Int32

Return Value

IList<T>.

Exceptions

Exception | Condition
ArgumentNullException | array

See Also

Algorithms Class


RemoveDuplicates Method

Algorithms..::..RemoveDuplicates Method

Overload List

Name | Description
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. A passed IEqualityComparer is used to determine equality.
RemoveDuplicates<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


RemoveDuplicates(T) Method (IEnumerable(T))

Algorithms..::..RemoveDuplicates<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> RemoveDuplicates<T>(
    IEnumerable<T> collection
)

Public Shared Function RemoveDuplicates(Of T) ( _
    collection As IEnumerable(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ RemoveDuplicates(
    IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.

Return Value

An new collection with the items from collection, in the same order, with consecutive duplicates removed.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
RemoveDuplicates Overload


RemoveDuplicates(T) Method (IEnumerable(T), IEqualityComparer(T))

Algorithms..::..RemoveDuplicates<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Remove consecutive equal items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> RemoveDuplicates<T>(
    IEnumerable<T> collection,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function RemoveDuplicates(Of T) ( _
    collection As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ RemoveDuplicates(
    IEnumerable<T>^ collection,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

An new collection with the items from collection, in the same order, with consecutive duplicates removed.

Exceptions

Exception | Condition
ArgumentNullException | collection or equalityComparer is null.

See Also

Algorithms Class
RemoveDuplicates Overload


RemoveDuplicates(T) Method (IEnumerable(T), BinaryPredicate(T))

Algorithms..::..RemoveDuplicates<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Remove consecutive "equal" items from a collection, yielding another collection. In each run of consecutive equal items in the collection, all items after the first item in the run are removed. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> RemoveDuplicates<T>(
    IEnumerable<T> collection,
    BinaryPredicate<T> predicate
)

Public Shared Function RemoveDuplicates(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ RemoveDuplicates(
    IEnumerable<T>^ collection,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality". An item current is removed if predicate(first, current)==true, where first is the first item in the group of "duplicate" items.

Return Value

An new collection with the items from collection, in the same order, with consecutive "duplicates" removed.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being removed need not be true equality.

See Also

Algorithms Class
RemoveDuplicates Overload


RemoveDuplicatesInPlace Method

Algorithms..::..RemoveDuplicatesInPlace Method

Overload List

Name | Description
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Remove consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The removal is done in-place, changing the list.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Remove subsequent consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
RemoveDuplicatesInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Remove consecutive "equal" items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. The passed BinaryPredicate is used to determine if two items are "equal".

See Also

Algorithms Class
Algorithms Members


RemoveDuplicatesInPlace(T) Method (IList(T))

Algorithms..::..RemoveDuplicatesInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Remove consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The removal is done in-place, changing the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RemoveDuplicatesInPlace<T>(
    IList<T> list
)

Public Shared Sub RemoveDuplicatesInPlace(Of T) ( _
    list As IList(Of T) _
)
public:
generic<typename T>
static void RemoveDuplicatesInPlace(
    IList<T>^ list
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
RemoveDuplicatesInPlace Overload


RemoveDuplicatesInPlace(T) Method (IList(T), IEqualityComparer(T))

Algorithms..::..RemoveDuplicatesInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Remove subsequent consecutive equal items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RemoveDuplicatesInPlace<T>(
    IList<T> list,
    IEqualityComparer<T> equalityComparer
)

Public Shared Sub RemoveDuplicatesInPlace(Of T) ( _
    list As IList(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
generic<typename T>
static void RemoveDuplicatesInPlace(
    IList<T>^ list,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
RemoveDuplicatesInPlace Overload


RemoveDuplicatesInPlace(T) Method (IList(T), BinaryPredicate(T))

Algorithms..::..RemoveDuplicatesInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Remove consecutive "equal" items from a list or array. In each run of consecutive equal items in the list, all items after the first item in the run are removed. The replacement is done in-place, changing the list. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RemoveDuplicatesInPlace<T>(
    IList<T> list,
    BinaryPredicate<T> predicate
)

Public Shared Sub RemoveDuplicatesInPlace(Of T) ( _
    list As IList(Of T), _
    predicate As BinaryPredicate(Of T) _
)
public:
generic<typename T>
static void RemoveDuplicatesInPlace(
    IList<T>^ list,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being tested for need not be true equality.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
RemoveDuplicatesInPlace Overload


RemoveWhere(T) Method

Algorithms..::..RemoveWhere<(Of <(<'T>)>)> Method

Removes all the items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static ICollection<T> RemoveWhere<T>(
    ICollection<T> collection,
    Predicate<T> predicate
)

Public Shared Function RemoveWhere(Of T) ( _
    collection As ICollection(Of T), _
    predicate As Predicate(Of T) _
) As ICollection(Of T)
public:
generic<typename T>
static ICollection<T>^ RemoveWhere(
    ICollection<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: ICollection <(Of <(<'T>)>)>
The collection to check all the items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

Returns a collection of the items that were removed. This collection contains the items in the same order that they orginally appeared in collection.

Remarks

If the collection if an array or implements IList<T>, an efficient algorithm that compacts items is used. If not, then ICollection<T>.Remove is used to remove items from the collection. If the collection is an array or fixed-size list, the non-removed elements are placed, in order, at the beginning of the list, and the remaining list items are filled with a default value (0 or null).

See Also

Algorithms Class


Replace Method

Algorithms..::..Replace Method

Overload List

Name | Description
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T) | Replace all items in a collection equal to a particular value with another values, yielding another collection.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a collection equal to a particular value with another values, yielding another collection. A passed IEqualityComparer is used to determine equality.
Replace<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .

See Also

Algorithms Class
Algorithms Members


Replace(T) Method (IEnumerable(T), T, T)

Algorithms..::..Replace<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, T, T)

Replace all items in a collection equal to a particular value with another values, yielding another collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Replace<T>(
    IEnumerable<T> collection,
    T itemFind,
    T replaceWith
)

Public Shared Function Replace(Of T) ( _
    collection As IEnumerable(Of T), _
    itemFind As T, _
    replaceWith As T _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Replace(
    IEnumerable<T>^ collection,
    T itemFind,
    T replaceWith
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
itemFind
Type: T
The value to find and replace within collection.
replaceWith
Type: T
The new value to replace with.

Return Value

An new collection with the items from collection, in the same order, with the appropriate replacements made.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
Replace Overload


Replace(T) Method (IEnumerable(T), T, T, IEqualityComparer(T))

Algorithms..::..Replace<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, T, T, IEqualityComparer<(Of <(<'T>)>)>)

Replace all items in a collection equal to a particular value with another values, yielding another collection. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Replace<T>(
    IEnumerable<T> collection,
    T itemFind,
    T replaceWith,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function Replace(Of T) ( _
    collection As IEnumerable(Of T), _
    itemFind As T, _
    replaceWith As T, _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Replace(
    IEnumerable<T>^ collection,
    T itemFind,
    T replaceWith,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
itemFind
Type: T
The value to find and replace within collection.
replaceWith
Type: T
The new value to replace with.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

An new collection with the items from collection, in the same order, with the appropriate replacements made.

See Also

Algorithms Class
Replace Overload


Replace(T) Method (IEnumerable(T), Predicate(T), T)

Algorithms..::..Replace<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Predicate<(Of <(<'T>)>)>, T)

Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Replace<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate,
    T replaceWith
)

Public Shared Function Replace(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T), _
    replaceWith As T _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Replace(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate,
    T replaceWith
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to process.
predicate
Type: Predicate <(Of <(<'T>)>)>
The predicate used to evaluate items with the collection. If the predicate returns true for a particular item, the item is replaces with replaceWith.
replaceWith
Type: T
The new value to replace with.

Return Value

An new collection with the items from collection, in the same order, with the appropriate replacements made.

See Also

Algorithms Class
Replace Overload


ReplaceInPlace Method

Algorithms..::..ReplaceInPlace Method

Overload List

Name | Description
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T) | Replace all items in a list or array equal to a particular value with another value. The replacement is done in-place, changing the list.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), T, T, IEqualityComparer<(Of <<'(T>)>>)) | Replace all items in a list or array equal to a particular value with another values. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.
ReplaceInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>), T) | Replace all items in a list or array that a predicate evaluates at true with a value. The replacement is done in-place, changing the list.

See Also

Algorithms Class
Algorithms Members


ReplaceInPlace(T) Method (IList(T), T, T)

Algorithms..::..ReplaceInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, T)

Replace all items in a list or array equal to a particular value with another value. The replacement is done in-place, changing the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void ReplaceInPlace<T>(
    IList<T> list,
    T itemFind,
    T replaceWith
)

Public Shared Sub ReplaceInPlace(Of T) ( _
    list As IList(Of T), _
    itemFind As T, _
    replaceWith As T _
)
public:
generic<typename T>
static void ReplaceInPlace(
    IList<T>^ list,
    T itemFind,
    T replaceWith
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.
itemFind
Type: T
The value to find and replace within collection.
replaceWith
Type: T
The new value to replace with.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
ReplaceInPlace Overload


ReplaceInPlace(T) Method (IList(T), T, T, IEqualityComparer(T))

Algorithms..::..ReplaceInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, T, T, IEqualityComparer<(Of <(<'T>)>)>)

Replace all items in a list or array equal to a particular value with another values. The replacement is done in-place, changing the list. A passed IEqualityComparer is used to determine equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void ReplaceInPlace<T>(
    IList<T> list,
    T itemFind,
    T replaceWith,
    IEqualityComparer<T> equalityComparer
)

Public Shared Sub ReplaceInPlace(Of T) ( _
    list As IList(Of T), _
    itemFind As T, _
    replaceWith As T, _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
generic<typename T>
static void ReplaceInPlace(
    IList<T>^ list,
    T itemFind,
    T replaceWith,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.
itemFind
Type: T
The value to find and replace within collection.
replaceWith
Type: T
The new value to replace with.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
ReplaceInPlace Overload


ReplaceInPlace(T) Method (IList(T), Predicate(T), T)

Algorithms..::..ReplaceInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Predicate<(Of <(<'T>)>)>, T)

Replace all items in a list or array that a predicate evaluates at true with a value. The replacement is done in-place, changing the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void ReplaceInPlace<T>(
    IList<T> list,
    Predicate<T> predicate,
    T replaceWith
)

Public Shared Sub ReplaceInPlace(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T), _
    replaceWith As T _
)
public:
generic<typename T>
static void ReplaceInPlace(
    IList<T>^ list,
    Predicate<T>^ predicate,
    T replaceWith
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to process.
predicate
Type: Predicate <(Of <(<'T>)>)>
The predicate used to evaluate items with the collection. If the predicate returns true for a particular item, the item is replaces with replaceWith.
replaceWith
Type: T
The new value to replace with.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
ReplaceInPlace Overload


Reverse(T) Method

Algorithms..::..Reverse<(Of <(<'T>)>)> Method

Reverses a list and returns the reversed list, without changing the source list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Reverse<T>(
    IList<T> source
)

Public Shared Function Reverse(Of T) ( _
    source As IList(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Reverse(
    IList<T>^ source
)

Type Parameters

T

Parameters

source
Type: IList <(Of <(<'T>)>)>
The list to reverse.

Return Value

A collection that contains the items from source in reverse order.

Exceptions

Exception | Condition
ArgumentNullException | source is null.

See Also

Algorithms Class


ReverseInPlace(T) Method

Algorithms..::..ReverseInPlace<(Of <(<'T>)>)> Method

Reverses a list or array in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void ReverseInPlace<T>(
    IList<T> list
)

Public Shared Sub ReverseInPlace(Of T) ( _
    list As IList(Of T) _
)
public:
generic<typename T>
static void ReverseInPlace(
    IList<T>^ list
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to reverse.

Exceptions

Exception | Condition
ArgumentNullException | list is null.
ArgumentException | list is read only.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class


Rotate(T) Method

Algorithms..::..Rotate<(Of <(<'T>)>)> Method

Rotates a list and returns the rotated list, without changing the source list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> Rotate<T>(
    IList<T> source,
    int amountToRotate
)

Public Shared Function Rotate(Of T) ( _
    source As IList(Of T), _
    amountToRotate As Integer _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ Rotate(
    IList<T>^ source,
    int^ amountToRotate
)

Type Parameters

T

Parameters

source
Type: IList <(Of <(<'T>)>)>
The list to rotate.
amountToRotate
Type: Int32
The number of elements to rotate. This value can be positive or negative. For example, rotating by positive 3 means that source[3] is the first item in the returned collection. Rotating by negative 3 means that source[source.Count - 3] is the first item in the returned collection.

Return Value

A collection that contains the items from source in rotated order.

Exceptions

Exception | Condition
ArgumentNullException | source is null.

See Also

Algorithms Class


RotateInPlace(T) Method

Algorithms..::..RotateInPlace<(Of <(<'T>)>)> Method

Rotates a list or array in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void RotateInPlace<T>(
    IList<T> list,
    int amountToRotate
)

Public Shared Sub RotateInPlace(Of T) ( _
    list As IList(Of T), _
    amountToRotate As Integer _
)
public:
generic<typename T>
static void RotateInPlace(
    IList<T>^ list,
    int^ amountToRotate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to rotate.
amountToRotate
Type: Int32
The number of elements to rotate. This value can be positive or negative. For example, rotating by positive 3 means that list[3] is the first item in the resulting list. Rotating by negative 3 means that list[list.Count - 3] is the first item in the resulting list.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class


SearchForSubsequence Method

Algorithms..::..SearchForSubsequence Method

Overload List

Name | Description
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern.
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), BinaryPredicate<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is "equal" to the first item in pattern, list[i+1] is "equal" to the second item in pattern, and so forth for all the items in pattern. The passed BinaryPredicate is used to determine if two items are "equal".
SearchForSubsequence<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.

See Also

Algorithms Class
Algorithms Members


SearchForSubsequence(T) Method (IList(T), IEnumerable(T))

Algorithms..::..SearchForSubsequence<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int SearchForSubsequence<T>(
    IList<T> list,
    IEnumerable<T> pattern
)

Public Shared Function SearchForSubsequence(Of T) ( _
    list As IList(Of T), _
    pattern As IEnumerable(Of T) _
) As Integer
public:
generic<typename T>
static int^ SearchForSubsequence(
    IList<T>^ list,
    IEnumerable<T>^ pattern
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
pattern
Type: IEnumerable <(Of <(<'T>)>)>
The sequence of items to search for.

Return Value

The first index with list that matches the items in pattern.

Remarks

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

See Also

Algorithms Class
SearchForSubsequence Overload


SearchForSubsequence(T) Method (IList(T), IEnumerable(T), BinaryPredicate(T))

Algorithms..::..SearchForSubsequence<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, BinaryPredicate<(Of <(<'T>)>)>)

Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is "equal" to the first item in pattern, list[i+1] is "equal" to the second item in pattern, and so forth for all the items in pattern. The passed BinaryPredicate is used to determine if two items are "equal".

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int SearchForSubsequence<T>(
    IList<T> list,
    IEnumerable<T> pattern,
    BinaryPredicate<T> predicate
)

Public Shared Function SearchForSubsequence(Of T) ( _
    list As IList(Of T), _
    pattern As IEnumerable(Of T), _
    predicate As BinaryPredicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ SearchForSubsequence(
    IList<T>^ list,
    IEnumerable<T>^ pattern,
    BinaryPredicate<T>^ predicate
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
pattern
Type: IEnumerable <(Of <(<'T>)>)>
The sequence of items to search for.
predicate
Type: Wintellect.PowerCollections..::..BinaryPredicate <(Of <(<'T>)>)>
The BinaryPredicate used to compare items for "equality".

Return Value

The first index with list that matches the items in pattern.

Remarks

Since an arbitrary BinaryPredicate is passed to this function, what is being tested for in the pattern need not be equality.

See Also

Algorithms Class
SearchForSubsequence Overload


SearchForSubsequence(T) Method (IList(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..SearchForSubsequence<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Searchs a list for a sub-sequence of items that match a particular pattern. A subsequence of list matches pattern at index i if list[i] is equal to the first item in pattern, list[i+1] is equal to the second item in pattern, and so forth for all the items in pattern. The passed instance of IEqualityComparer<T> is used for determining if two items are equal.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int SearchForSubsequence<T>(
    IList<T> list,
    IEnumerable<T> pattern,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function SearchForSubsequence(Of T) ( _
    list As IList(Of T), _
    pattern As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As Integer
public:
generic<typename T>
static int^ SearchForSubsequence(
    IList<T>^ list,
    IEnumerable<T>^ pattern,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T
The type of items in the list.

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list to search.
pattern
Type: IEnumerable <(Of <(<'T>)>)>
The sequence of items to search for.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals method will be called.

Return Value

The first index with list that matches the items in pattern.

See Also

Algorithms Class
SearchForSubsequence Overload


SetDifference Method

Algorithms..::..SetDifference Method

Overload List

Name | Description
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.
SetDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.

See Also

Algorithms Class
Algorithms Members


SetDifference(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..SetDifference<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetDifference<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function SetDifference(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetDifference(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to difference.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to difference.

Return Value

The difference of collection1 and collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the Difference or DifferenceWith methods on that class.

See Also

Algorithms Class
SetDifference Overload


SetDifference(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..SetDifference<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Computes the set-theoretic difference of two collections. The difference of two sets is all items that appear in the first set, but not in the second. If an item appears X times in the first set, and Y times in the second set, the difference contains the item X - Y times (0 times if X < Y). The source collections are not changed. A new collection is created with the difference of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetDifference<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function SetDifference(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetDifference(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to difference.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to difference.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

The difference of collection1 and collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the difference or differenceWith methods on that class.

See Also

Algorithms Class
SetDifference Overload


SetIntersection Method

Algorithms..::..SetIntersection Method

Overload List

Name | Description
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.
SetIntersection<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.

See Also

Algorithms Class
Algorithms Members


SetIntersection(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..SetIntersection<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetIntersection<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function SetIntersection(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetIntersection(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to intersect.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to intersect.

Return Value

The intersection of the two collections, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the Intersection or IntersectionWith methods on that class.

See Also

Algorithms Class
SetIntersection Overload


SetIntersection(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..SetIntersection<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Computes the set-theoretic intersection of two collections. The intersection of two sets is all items that appear in both of the sets. If an item appears X times in one set, and Y times in the other set, the intersection contains the item Minimum(X,Y) times. The source collections are not changed. A new collection is created with the intersection of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetIntersection<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function SetIntersection(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetIntersection(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to intersect.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to intersect.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

The intersection of the two collections, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the Intersection or IntersectionWith methods on that class.

See Also

Algorithms Class
SetIntersection Overload


SetSymmetricDifference Method

Algorithms..::..SetSymmetricDifference Method

Overload List

Name | Description
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.
SetSymmetricDifference<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.

See Also

Algorithms Class
Algorithms Members


SetSymmetricDifference(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..SetSymmetricDifference<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetSymmetricDifference<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function SetSymmetricDifference(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetSymmetricDifference(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to symmetric difference.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to symmetric difference.

Return Value

The symmetric difference of collection1 and collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the SymmetricDifference or SymmetricDifferenceWith methods on that class.

See Also

Algorithms Class
SetSymmetricDifference Overload


SetSymmetricDifference(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..SetSymmetricDifference<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Computes the set-theoretic symmetric difference of two collections. The symmetric difference of two sets is all items that appear in the one of the sets, but not in the other. If an item appears X times in the one set, and Y times in the other set, the symmetric difference contains the item AbsoluteValue(X - Y) times. The source collections are not changed. A new collection is created with the symmetric difference of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetSymmetricDifference<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function SetSymmetricDifference(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetSymmetricDifference(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to symmetric difference.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to symmetric difference.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

The symmetric difference of collection1 and collection2, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the symmetric difference or symmetric differenceWith methods on that class.

See Also

Algorithms Class
SetSymmetricDifference Overload


SetUnion Method

Algorithms..::..SetUnion Method

Overload List

Name | Description
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.
SetUnion<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.

See Also

Algorithms Class
Algorithms Members


SetUnion(T) Method (IEnumerable(T), IEnumerable(T))

Algorithms..::..SetUnion<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>)

Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetUnion<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2
)

Public Shared Function SetUnion(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetUnion(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to union.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to union.

Return Value

The union of the two collections, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

The default sense of equality for T is used, as defined by T's implementation of IComparable<T>.Equals or object.Equals.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the Union or UnionWith methods on that class.

See Also

Algorithms Class
SetUnion Overload


SetUnion(T) Method (IEnumerable(T), IEnumerable(T), IEqualityComparer(T))

Algorithms..::..SetUnion<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Computes the set-theoretic union of two collections. The union of two sets is all items that appear in either of the sets. If an item appears X times in one set, and Y times in the other set, the union contains the item Maximum(X,Y) times. The source collections are not changed. A new collection is created with the union of the collections; the order of the items in this collection is undefined.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> SetUnion<T>(
    IEnumerable<T> collection1,
    IEnumerable<T> collection2,
    IEqualityComparer<T> equalityComparer
)

Public Shared Function SetUnion(Of T) ( _
    collection1 As IEnumerable(Of T), _
    collection2 As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ SetUnion(
    IEnumerable<T>^ collection1,
    IEnumerable<T>^ collection2,
    IEqualityComparer<T>^ equalityComparer
)

Type Parameters

T

Parameters

collection1
Type: IEnumerable <(Of <(<'T>)>)>
The first collection to union.
collection2
Type: IEnumerable <(Of <(<'T>)>)>
The second collection to union.
equalityComparer
Type: IEqualityComparer <(Of <(<'T>)>)>
The IEqualityComparer<T> used to compare items for equality. Only the Equals and GetHashCode member functions of this interface are called.

Return Value

The union of the two collections, considered as sets.

Exceptions

Exception | Condition
ArgumentNullException | collection1 or collection2 is null.

Remarks

When equal items appear in both collections, the returned collection will include an arbitrary choice of one of the two equal items.

If both collections are Set, Bag, OrderedSet, or OrderedBag collections, it is more efficient to use the union or unionWith methods on that class.

See Also

Algorithms Class
SetUnion Overload


Sort Method

Algorithms..::..Sort Method

Overload List

Name | Description
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied IComparer<T> is used to compare the items in the collection.
Sort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


Sort(T) Method (IEnumerable(T))

Algorithms..::..Sort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Creates a sorted version of a collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] Sort<T>(
    IEnumerable<T> collection
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Sort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ Sort(
    IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.

Return Value

An array containing the sorted version of the collection.

Remarks

Values are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
Sort Overload


Sort(T) Method (IEnumerable(T), IComparer(T))

Algorithms..::..Sort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Creates a sorted version of a collection. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] Sort<T>(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Sort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ Sort(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Return Value

An array containing the sorted version of the collection.

See Also

Algorithms Class
Sort Overload


Sort(T) Method (IEnumerable(T), Comparison(T))

Algorithms..::..Sort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Creates a sorted version of a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] Sort<T>(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function Sort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ Sort(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to compare items in the collection.

Return Value

An array containing the sorted version of the collection.

See Also

Algorithms Class
Sort Overload


SortInPlace Method

Algorithms..::..SortInPlace Method

Overload List

Name | Description
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.
SortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.

See Also

Algorithms Class
Algorithms Members


SortInPlace(T) Method (IList(T))

Algorithms..::..SortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Sorts a list or array in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void SortInPlace<T>(
    IList<T> list
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub SortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void SortInPlace(
    IList<T>^ list
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Values are compared by using the IComparable<T> interfaces implementation on the type T.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
SortInPlace Overload


SortInPlace(T) Method (IList(T), IComparer(T))

Algorithms..::..SortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void SortInPlace<T>(
    IList<T> list,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub SortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparer As IComparer(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void SortInPlace(
    IList<T>^ list,
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
SortInPlace Overload


SortInPlace(T) Method (IList(T), Comparison(T))

Algorithms..::..SortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void SortInPlace<T>(
    IList<T> list,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub SortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparison As Comparison(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void SortInPlace(
    IList<T>^ list,
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to compare items in the collection.

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
SortInPlace Overload


StablePartition(T) Method

Algorithms..::..StablePartition<(Of <(<'T>)>)> Method

Partition a list or array based on a predicate. After partitioning, all items for which the predicate returned true precede all items for which the predicate returned false. The partition is stable, which means that if items X and Y have the same result from the predicate, and X precedes Y in the original list, X will precede Y in the partitioned list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static int StablePartition<T>(
    IList<T> list,
    Predicate<T> predicate
)

Public Shared Function StablePartition(Of T) ( _
    list As IList(Of T), _
    predicate As Predicate(Of T) _
) As Integer
public:
generic<typename T>
static int^ StablePartition(
    IList<T>^ list,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to partition.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the partitioning condition.

Return Value

The index of the first item in the second half of the partition; i.e., the first item for which predicate returned false. If the predicate was true for all items in the list, list.Count is returned.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class


StableSort Method

Algorithms..::..StableSort Method

Overload List

Name | Description
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the collection.
StableSort<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

See Also

Algorithms Class
Algorithms Members


StableSort(T) Method (IEnumerable(T))

Algorithms..::..StableSort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] StableSort<T>(
    IEnumerable<T> collection
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function StableSort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ StableSort(
    IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.

Return Value

An array containing the sorted version of the collection.

Remarks

Values are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
StableSort Overload


StableSort(T) Method (IEnumerable(T), IComparer(T))

Algorithms..::..StableSort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] StableSort<T>(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function StableSort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ StableSort(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Return Value

An array containing the sorted version of the collection.

See Also

Algorithms Class
StableSort Overload


StableSort(T) Method (IEnumerable(T), Comparison(T))

Algorithms..::..StableSort<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Creates a sorted version of a collection. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] StableSort<T>(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Function StableSort(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
) As T()
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static array<T>^ StableSort(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to sort.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to compare items in the collection.

Return Value

An array containing the sorted version of the collection.

Remarks

Values are compared by using the IComparable<T> interfaces implementation on the type T.

See Also

Algorithms Class
StableSort Overload


StableSortInPlace Method

Algorithms..::..StableSortInPlace Method

Overload List

Name | Description
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the list.
StableSortInPlace<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the list.

See Also

Algorithms Class
Algorithms Members


StableSortInPlace(T) Method (IList(T))

Algorithms..::..StableSortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void StableSortInPlace<T>(
    IList<T> list
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub StableSortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void StableSortInPlace(
    IList<T>^ list
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.

Remarks

Values are compared by using the IComparable<T> interfaces implementation on the type T.

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
StableSortInPlace Overload


StableSortInPlace(T) Method (IList(T), IComparer(T))

Algorithms..::..StableSortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied IComparer<T> is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void StableSortInPlace<T>(
    IList<T> list,
    IComparer<T> comparer
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub StableSortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparer As IComparer(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void StableSortInPlace(
    IList<T>^ list,
    IComparer<T>^ comparer
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.
comparer
Type: IComparer <(Of <(<'T>)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
StableSortInPlace Overload


StableSortInPlace(T) Method (IList(T), Comparison(T))

Algorithms..::..StableSortInPlace<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Sorts a list or array in place. The sort is stable, which means that if items X and Y are equal, and X precedes Y in the unsorted collection, X will precede Y is the sorted collection. A supplied Comparison<T> delegate is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static void StableSortInPlace<T>(
    IList<T> list,
    Comparison<T> comparison
)
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>

Public Shared Sub StableSortInPlace(Of T As {IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T), IComparable(Of T)}) ( _
    list As IList(Of T), _
    comparison As Comparison(Of T) _
)
public:
generic<typename T>
where T : IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>, IComparable<T>
static void StableSortInPlace(
    IList<T>^ list,
    Comparison<T>^ comparison
)

Type Parameters

T

Parameters

list
Type: IList <(Of <(<'T>)>)>
The list or array to sort.
comparison
Type: Comparison <(Of <(<'T>)>)>
The comparison delegate used to compare items in the collection.

Remarks

Although arrays cast to IList<T> are normally read-only, this method will work correctly and modify an array passed as list.

See Also

Algorithms Class
StableSortInPlace Overload


ToArray(T) Method

Algorithms..::..ToArray<(Of <(<'T>)>)> Method

Create an array with the items in a collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static T[] ToArray<T>(
    IEnumerable<T> collection
)

Public Shared Function ToArray(Of T) ( _
    collection As IEnumerable(Of T) _
) As T()
public:
generic<typename T>
static array<T>^ ToArray(
    IEnumerable<T>^ collection
)

Type Parameters

T
Element type of the collection.

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
Collection to create array from.

Return Value

An array with the items from the collection, in enumeration order.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

If collection implements ICollection<T>T, then ICollection<T>.CopyTo() is used to fill the array. Otherwise, the IEnumerable<T>.GetEnumerator() is used to fill the array.

See Also

Algorithms Class


ToString Method

Algorithms..::..ToString Method

Overload List

Name | Description
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>)) | Gets a string representation of the elements in the collection. The string representation starts with "{", has a list of items separated by commas (","), and ends with "}". Each item in the collection is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.
ToString<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Boolean, String, String, String) | Gets a string representation of the elements in the collection. The string to used at the beginning and end, and to separate items, and supplied by parameters. Each item in the collection is converted to a string by calling its ToString method (null is represented by "null").
ToString<(Of <<'(TKey, TValue>)>>)(IDictionary<(Of <<'(TKey, TValue>)>>)) | Gets a string representation of the mappings in a dictionary. The string representation starts with "{", has a list of mappings separated by commas (", "), and ends with "}". Each mapping is represented by "key->value". Each key and value in the dictionary is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.

See Also

Algorithms Class
Algorithms Members


ToString(T) Method (IEnumerable(T))

Algorithms..::..ToString<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>)

Gets a string representation of the elements in the collection. The string representation starts with "{", has a list of items separated by commas (","), and ends with "}". Each item in the collection is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static string ToString<T>(
    IEnumerable<T> collection
)

Public Shared Function ToString(Of T) ( _
    collection As IEnumerable(Of T) _
) As String
public:
generic<typename T>
static String^ ToString(
    IEnumerable<T>^ collection
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
A collection to get the string representation of.

Return Value

The string representation of the collection. If collection is null, then the string "null" is returned.

See Also

Algorithms Class
ToString Overload


ToString(T) Method (IEnumerable(T), Boolean, String, String, String)

Algorithms..::..ToString<(Of <(<'T>)>)> Method (IEnumerable<(Of <(<'T>)>)>, Boolean, String, String, String)

Gets a string representation of the elements in the collection. The string to used at the beginning and end, and to separate items, and supplied by parameters. Each item in the collection is converted to a string by calling its ToString method (null is represented by "null").

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static string ToString<T>(
    IEnumerable<T> collection,
    bool recursive,
    string start,
    string separator,
    string end
)

Public Shared Function ToString(Of T) ( _
    collection As IEnumerable(Of T), _
    recursive As Boolean, _
    start As String, _
    separator As String, _
    end As String _
) As String
public:
generic<typename T>
static String^ ToString(
    IEnumerable<T>^ collection,
    bool^ recursive,
    String^ start,
    String^ separator,
    String^ end
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
A collection to get the string representation of.
recursive
Type: Boolean
If true, contained collections (except strings) are converted to strings by a recursive call to this method, instead of by calling ToString.
start
Type: String
The string to appear at the beginning of the output string.
separator
Type: String
The string to appear between each item in the string.
end
Type: String
The string to appear at the end of the output string.

Return Value

The string representation of the collection. If collection is null, then the string "null" is returned.

Exceptions

Exception | Condition
ArgumentNullException | start, separator, or end is null.

See Also

Algorithms Class
ToString Overload


ToString(TKey, TValue) Method (IDictionary(TKey, TValue))

Algorithms..::..ToString<(Of <(<'TKey, TValue>)>)> Method (IDictionary<(Of <(<'TKey, TValue>)>)>)

Gets a string representation of the mappings in a dictionary. The string representation starts with "{", has a list of mappings separated by commas (", "), and ends with "}". Each mapping is represented by "key->value". Each key and value in the dictionary is converted to a string by calling its ToString method (null is represented by "null"). Contained collections (except strings) are recursively converted to strings by this method.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static string ToString<TKey, TValue>(
    IDictionary<TKey, TValue> dictionary
)

Public Shared Function ToString(Of TKey, TValue) ( _
    dictionary As IDictionary(Of TKey, TValue) _
) As String
public:
generic<typename TKey, typename TValue>
static String^ ToString(
    IDictionary<TKey, TValue>^ dictionary
)

Type Parameters

TKey
TValue

Parameters

dictionary
Type: IDictionary <(Of <(<'TKey, TValue>)>)>
A dictionary to get the string representation of.

Return Value

The string representation of the collection, or "null" if dictionary is null.

See Also

Algorithms Class
ToString Overload


TrueForAll(T) Method

Algorithms..::..TrueForAll<(Of <(<'T>)>)> Method

Determines if all of the items in the collection satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool TrueForAll<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate
)

Public Shared Function TrueForAll(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T) _
) As Boolean
public:
generic<typename T>
static bool^ TrueForAll(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to check all the items in.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defines the condition to check for.

Return Value

True if all of the items in the collection satisfy the condition defined by predicate, or if the collection is empty. False if one or more items in the collection do not satisfy predicate.

See Also

Algorithms Class


TryFindFirstWhere(T) Method

Algorithms..::..TryFindFirstWhere<(Of <(<'T>)>)> Method

Finds the first item in a collection that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool TryFindFirstWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate,
    out T foundItem
)

Public Shared Function TryFindFirstWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
generic<typename T>
static bool^ TryFindFirstWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.
foundItem
Type: T%
Outputs the first item in the collection that matches the condition, if the method returns true.

Return Value

True if an item satisfying the condition was found. False if no such item exists in the collection.

See Also

Algorithms Class
Wintellect.PowerCollections Namespace
Algorithms..::..FindFirstWhere<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>))


TryFindLastWhere(T) Method

Algorithms..::..TryFindLastWhere<(Of <(<'T>)>)> Method

Finds the last item in a collection that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool TryFindLastWhere<T>(
    IEnumerable<T> collection,
    Predicate<T> predicate,
    out T foundItem
)

Public Shared Function TryFindLastWhere(Of T) ( _
    collection As IEnumerable(Of T), _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
generic<typename T>
static bool^ TryFindLastWhere(
    IEnumerable<T>^ collection,
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Type Parameters

T

Parameters

collection
Type: IEnumerable <(Of <(<'T>)>)>
The collection to search.
predicate
Type: Predicate <(Of <(<'T>)>)>
A delegate that defined the condition to check for.
foundItem
Type: T%
Outputs the last item in the collection that matches the condition, if the method returns true.

Return Value

True if an item satisfying the condition was found. False if no such item exists in the collection.

Remarks

If the collection implements IList<T>, then the list is scanned in reverse until a matching item is found. Otherwise, the entire collection is iterated in the forward direction.

See Also

Algorithms Class
Wintellect.PowerCollections Namespace
Algorithms..::..FindLastWhere<(Of <<'(T>)>>)(IEnumerable<(Of <<'(T>)>>), Predicate<(Of <<'(T>)>>))


TypedAs Method

Algorithms..::..TypedAs Method

Overload List

Name | Description
TypedAs<(Of <<'(T>)>>)(IEnumerable) | Given a non-generic IEnumerable interface, wrap a generic IEnumerable<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(ICollection) | Given a non-generic ICollection interface, wrap a generic ICollection<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.
TypedAs<(Of <<'(T>)>>)(IList) | Given a non-generic IList interface, wrap a generic IList<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic list, but can be used in places that require a generic interface. The underlying non-generic list must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic lists to newer code that uses generic interfaces.

See Also

Algorithms Class
Algorithms Members


TypedAs(T) Method (IEnumerable)

Algorithms..::..TypedAs<(Of <(<'T>)>)> Method (IEnumerable)

Given a non-generic IEnumerable interface, wrap a generic IEnumerable<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IEnumerable<T> TypedAs<T>(
    IEnumerable untypedCollection
)

Public Shared Function TypedAs(Of T) ( _
    untypedCollection As IEnumerable _
) As IEnumerable(Of T)
public:
generic<typename T>
static IEnumerable<T>^ TypedAs(
    IEnumerable^ untypedCollection
)

Type Parameters

T
The item type of the wrapper collection.

Parameters

untypedCollection
Type: IEnumerable
An untyped collection. This collection should only contain items of type T or a type derived from it.

Return Value

A generic IEnumerable<T> wrapper around untypedCollection. If untypedCollection is null, then null is returned.

Remarks

Some collections implement both generic and non-generic interfaces. For efficiency, this method will first attempt to cast untypedCollection to IEnumerable<T>. If that succeeds, it is returned; otherwise, a wrapper object is created.

See Also

Algorithms Class
TypedAs Overload


TypedAs(T) Method (ICollection)

Algorithms..::..TypedAs<(Of <(<'T>)>)> Method (ICollection)

Given a non-generic ICollection interface, wrap a generic ICollection<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic collection, but can be used in places that require a generic interface. The underlying non-generic collection must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic collections to newer code that uses generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static ICollection<T> TypedAs<T>(
    ICollection untypedCollection
)

Public Shared Function TypedAs(Of T) ( _
    untypedCollection As ICollection _
) As ICollection(Of T)
public:
generic<typename T>
static ICollection<T>^ TypedAs(
    ICollection^ untypedCollection
)

Type Parameters

T
The item type of the wrapper collection.

Parameters

untypedCollection
Type: ICollection
An untyped collection. This collection should only contain items of type T or a type derived from it.

Return Value

A generic ICollection<T> wrapper around untypedCollection. If untypedCollection is null, then null is returned.

Remarks

Some collections implement both generic and non-generic interfaces. For efficiency, this method will first attempt to cast untypedCollection to ICollection<T>. If that succeeds, it is returned; otherwise, a wrapper object is created.

Unlike the generic interface, the non-generic ICollection interfaces does not contain methods for adding or removing items from the collection. For this reason, the returned ICollection<T> will be read-only.

See Also

Algorithms Class
TypedAs Overload


TypedAs(T) Method (IList)

Algorithms..::..TypedAs<(Of <(<'T>)>)> Method (IList)

Given a non-generic IList interface, wrap a generic IList<T> interface around it. The generic interface will enumerate the same objects as the underlying non-generic list, but can be used in places that require a generic interface. The underlying non-generic list must contain only items that are of type T or a type derived from it. This method is useful when interfacing older, non-generic lists to newer code that uses generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList<T> TypedAs<T>(
    IList untypedList
)

Public Shared Function TypedAs(Of T) ( _
    untypedList As IList _
) As IList(Of T)
public:
generic<typename T>
static IList<T>^ TypedAs(
    IList^ untypedList
)

Type Parameters

T
The item type of the wrapper list.

Parameters

untypedList
Type: IList
An untyped list. This list should only contain items of type T or a type derived from it.

Return Value

A generic IList<T> wrapper around untypedlist. If untypedlist is null, then null is returned.

Remarks

Some collections implement both generic and non-generic interfaces. For efficiency, this method will first attempt to cast untypedList to IList<T>. If that succeeds, it is returned; otherwise, a wrapper object is created.

See Also

Algorithms Class
TypedAs Overload


Untyped Method

Algorithms..::..Untyped Method

Overload List

Name | Description
Untyped<(Of <<'(T>)>>)(ICollection<(Of <<'(T>)>>)) | Given a generic ICollection<T> interface, wrap a non-generic (untyped) ICollection interface around it. The non-generic interface will contain the same objects as the underlying generic collection, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.
Untyped<(Of <<'(T>)>>)(IList<(Of <<'(T>)>>)) | Given a generic IList<T> interface, wrap a non-generic (untyped) IList interface around it. The non-generic interface will contain the same objects as the underlying generic list, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

See Also

Algorithms Class
Algorithms Members


Untyped(T) Method (ICollection(T))

Algorithms..::..Untyped<(Of <(<'T>)>)> Method (ICollection<(Of <(<'T>)>)>)

Given a generic ICollection<T> interface, wrap a non-generic (untyped) ICollection interface around it. The non-generic interface will contain the same objects as the underlying generic collection, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static ICollection Untyped<T>(
    ICollection<T> typedCollection
)

Public Shared Function Untyped(Of T) ( _
    typedCollection As ICollection(Of T) _
) As ICollection
public:
generic<typename T>
static ICollection^ Untyped(
    ICollection<T>^ typedCollection
)

Type Parameters

T
The item type of the underlying collection.

Parameters

typedCollection
Type: ICollection <(Of <(<'T>)>)>
A typed collection to wrap.

Return Value

A non-generic ICollection wrapper around typedCollection. If typedCollection is null, then null is returned.

Remarks

Many generic collections already implement the non-generic interfaces directly. This method will first attempt to simply cast typedCollection to ICollection. If that succeeds, it is returned; if it fails, then a wrapper object is created.

See Also

Algorithms Class
Untyped Overload


Untyped(T) Method (IList(T))

Algorithms..::..Untyped<(Of <(<'T>)>)> Method (IList<(Of <(<'T>)>)>)

Given a generic IList<T> interface, wrap a non-generic (untyped) IList interface around it. The non-generic interface will contain the same objects as the underlying generic list, but can be used in places that require a non-generic interface. This method is useful when interfacing generic interfaces with older code that uses non-generic interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static IList Untyped<T>(
    IList<T> typedList
)

Public Shared Function Untyped(Of T) ( _
    typedList As IList(Of T) _
) As IList
public:
generic<typename T>
static IList^ Untyped(
    IList<T>^ typedList
)

Type Parameters

T
The item type of the underlying list.

Parameters

typedList
Type: IList <(Of <(<'T>)>)>
A typed list to wrap.

Return Value

A non-generic IList wrapper around typedList. If typedList is null, then null is returned.

Remarks

Many generic collections already implement the non-generic interfaces directly. This method will first attempt to simply cast typedList to IList. If that succeeds, it is returned; if it fails, then a wrapper object is created.

See Also

Algorithms Class
Untyped Overload


Bag(T) Class

Bag<(Of <(<'T>)>)> Class

Bag<T> is a collection that contains items of type T. Unlike a Set, duplicate items (items that compare equal to each other) are allowed in an Bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class Bag<T> : CollectionBase<T>

<SerializableAttribute> _
Public Class Bag(Of T) _
    Inherits CollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class Bag : public CollectionBase<T>

Type Parameters

T

Remarks

The items are compared in one of two ways. If T implements IComparable<T> then the Equals method of that interface will be used to compare items, otherwise the Equals method from Object will be used. Alternatively, an instance of IComparer<T> can be passed to the constructor to use to compare items.

Bag is implemented as a hash table. Inserting, deleting, and looking up an an element all are done in approximately constant time, regardless of the number of items in the bag.

When multiple equal items are stored in the bag, they are stored as a representative item and a count. If equal items can be distinguished, this may be noticable. For example, if a case-insensitive comparer is used with a Bag<string>, and both "hello", and "HELLO" are added to the bag, then the bag will appear to contain two copies of "hello" (the representative item).

OrderedBag<(Of <(<'T>)>)> is similar, but uses comparison instead of hashing, maintain the items in sorted order, and stores distinct copies of items that compare equal.

Inheritance Hierarchy

Wintellect.PowerCollections..::..CollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..Bag<(Of <(<'T>)>)>

See Also

Bag<(Of <(<'T>)>)> Members
Wintellect.PowerCollections Namespace
Wintellect.PowerCollections..::..OrderedBag<(Of <(<'T>)>)>


Bag(T) Members

Bag<(Of <(<'T>)>)> Members

The Bag<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | Bag<(Of <(<'T>)>)>()()()() | Creates a new Bag.
Public method | Bag<(Of <(<'T>)>)>(IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag for equality.
Public method | Bag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new Bag. The bag is initialized with all the items in the given collection.
Public method | Bag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the count of items for the representative item is increased by one, but the existing represetative item is unchanged.
Public method | AddMany | Adds all the items in collection to the bag.
Public method | AddRepresentative | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case (unlike Add), the new item becomes the representative item.
Public method | ChangeNumberOfCopies | Changes the number of copies of an existing item in the bag, or adds the indicated number of copies of the item to the bag.
Public method | Clear | Removes all items from the bag.
Public method | Clone | Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Determines if this bag contains an item equal to item. The bag is not changed.
Public method | Difference | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | DifferenceWith | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.
Public method | DistinctItems | Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.
Public method | GetEnumerator | Returns an enumerator that enumerates all the items in the bag. If an item is present multiple times in the bag, the representative item is yielded by the enumerator multiple times. The order of enumeration is haphazard and may change.
Public method | GetRepresentativeItem | Returns the representative item stored in the bag that is equal to the provided item. Also returns the number of copies of the item in the bag.
Public method | Intersection | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the intersection contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.
Public method | IntersectionWith | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.
Public method | IsDisjointFrom | Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.
Public method | IsEqualTo | Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same number of of copies of equal elements.
Public method | IsProperSubsetOf | Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.
Public method | IsProperSupersetOf | Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.
Public method | IsSubsetOf | Determines if this bag is a subset of another ba11 items in this bag.
Public method | IsSupersetOf | Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.
Public method | NumberOfCopies | Returns the number of copies of item in the bag.
Public method | Remove | Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged.
Public method | RemoveAllCopies | Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.
Public method | RemoveMany | Removes all the items in collection from the bag. Items that are not present in the bag are ignored.
Public method | Sum | Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.
Public method | SumWith | Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.
Public method | SymmetricDifference | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | SymmetricDifferenceWith | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. This bag receives the symmetric difference of the two bags; the other bag is unchanged.
Public method | Union | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.
Public method | UnionWith | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

Properties

 | Name | Description
Public property | Comparer | Returns the IEqualityComparer<T> used to compare items in this bag.
Public property | Count | Returns the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Bag(T) Constructor

Bag<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | Bag<(Of <(<'T>)>)>()()()() | Creates a new Bag.
Public method | Bag<(Of <(<'T>)>)>(IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag for equality.
Public method | Bag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new Bag. The bag is initialized with all the items in the given collection.
Public method | Bag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

See Also

Bag<(Of <(<'T>)>)> Class
Bag<(Of <(<'T>)>)> Members


Bag(T) Constructor

Bag<(Of <(<'T>)>)> Constructor

Creates a new Bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag()
Public Sub New
public:
Bag()

Remarks

Items that are null are permitted.

See Also

Bag<(Of <(<'T>)>)> Class
Bag<(Of <(<'T>)>)> Overload


Bag(T) Constructor (IEqualityComparer(T))

Bag<(Of <(<'T>)>)> Constructor (IEqualityComparer<(Of <(<'T>)>)>)

Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag for equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag(
    IEqualityComparer<T> equalityComparer
)
Public Sub New ( _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
Bag(
    IEqualityComparer<T>^ equalityComparer
)

Parameters

equalityComparer
Type: IEqualityComparer <(Of <(<' T >)>)>
An instance of IEqualityComparer<T> that will be used to compare items.

See Also

Bag<(Of <(<'T>)>)> Class
Bag<(Of <(<'T>)>)> Overload


Bag(T) Constructor (IEnumerable(T))

Bag<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Creates a new Bag. The bag is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
Bag(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the Bag.

Remarks

Items that are null are permitted.

See Also

Bag<(Of <(<'T>)>)> Class
Bag<(Of <(<'T>)>)> Overload


Bag(T) Constructor (IEnumerable(T), IEqualityComparer(T))

Bag<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Creates a new Bag. The Equals and GetHashCode methods of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag(
    IEnumerable<T> collection,
    IEqualityComparer<T> equalityComparer
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
Bag(
    IEnumerable<T>^ collection,
    IEqualityComparer<T>^ equalityComparer
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the Bag.
equalityComparer
Type: IEqualityComparer <(Of <(<' T >)>)>
An instance of IEqualityComparer<T> that will be used to compare items.

See Also

Bag<(Of <(<'T>)>)> Class
Bag<(Of <(<'T>)>)> Overload


Bag(T) Methods

Bag<(Of <(<'T>)>)> Methods

The Bag<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the count of items for the representative item is increased by one, but the existing represetative item is unchanged.
Public method | AddMany | Adds all the items in collection to the bag.
Public method | AddRepresentative | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case (unlike Add), the new item becomes the representative item.
Public method | ChangeNumberOfCopies | Changes the number of copies of an existing item in the bag, or adds the indicated number of copies of the item to the bag.
Public method | Clear | Removes all items from the bag.
Public method | Clone | Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Determines if this bag contains an item equal to item. The bag is not changed.
Public method | Difference | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | DifferenceWith | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.
Public method | DistinctItems | Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.
Public method | GetEnumerator | Returns an enumerator that enumerates all the items in the bag. If an item is present multiple times in the bag, the representative item is yielded by the enumerator multiple times. The order of enumeration is haphazard and may change.
Public method | GetRepresentativeItem | Returns the representative item stored in the bag that is equal to the provided item. Also returns the number of copies of the item in the bag.
Public method | Intersection | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the intersection contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.
Public method | IntersectionWith | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.
Public method | IsDisjointFrom | Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.
Public method | IsEqualTo | Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same number of of copies of equal elements.
Public method | IsProperSubsetOf | Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.
Public method | IsProperSupersetOf | Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.
Public method | IsSubsetOf | Determines if this bag is a subset of another ba11 items in this bag.
Public method | IsSupersetOf | Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.
Public method | NumberOfCopies | Returns the number of copies of item in the bag.
Public method | Remove | Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged.
Public method | RemoveAllCopies | Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.
Public method | RemoveMany | Removes all the items in collection from the bag. Items that are not present in the bag are ignored.
Public method | Sum | Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.
Public method | SumWith | Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.
Public method | SymmetricDifference | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | SymmetricDifferenceWith | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. This bag receives the symmetric difference of the two bags; the other bag is unchanged.
Public method | Union | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.
Public method | UnionWith | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

See Also

Bag<(Of <(<'T>)>)> Class


Add Method

Bag<(Of <(<'T>)>)>..::..Add Method

Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the count of items for the representative item is increased by one, but the existing represetative item is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add to the bag.

Remarks

Adding an item takes approximately constant time, regardless of the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


AddMany Method

Bag<(Of <(<'T>)>)>..::..AddMany Method

Adds all the items in collection to the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddMany(
    IEnumerable<T> collection
)
Public Sub AddMany ( _
    collection As IEnumerable(Of T) _
)
public:
void AddMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to add to the bag.

Remarks

Adding the collection takes time O(M log N), where N is the number of items in the bag, and M is the number of items in collection.

See Also

Bag<(Of <(<'T>)>)> Class


AddRepresentative Method

Bag<(Of <(<'T>)>)>..::..AddRepresentative Method

Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case (unlike Add), the new item becomes the representative item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddRepresentative(
    T item
)
Public Sub AddRepresentative ( _
    item As T _
)
public:
void AddRepresentative(
    T item
)

Parameters

item
Type: T
The item to add to the bag.

Remarks

Adding an item takes approximately constant time, regardless of the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


ChangeNumberOfCopies Method

Bag<(Of <(<'T>)>)>..::..ChangeNumberOfCopies Method

Changes the number of copies of an existing item in the bag, or adds the indicated number of copies of the item to the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void ChangeNumberOfCopies(
    T item,
    int numCopies
)
Public Sub ChangeNumberOfCopies ( _
    item As T, _
    numCopies As Integer _
)
public:
void ChangeNumberOfCopies(
    T item,
    int^ numCopies
)

Parameters

item
Type: T
The item to change the number of copies of. This may or may not already be present in the bag.
numCopies
Type: Int32
The new number of copies of the item.

Remarks

Changing the number of copies takes approximately constant time, regardless of the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Clear Method

Bag<(Of <(<'T>)>)>..::..Clear Method

Removes all items from the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the bag takes a constant amount of time, regardless of the number of items in it.

See Also

Bag<(Of <(<'T>)>)> Class


Clone Method

Bag<(Of <(<'T>)>)>..::..Clone Method

Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> Clone()
Public Function Clone As Bag(Of T)
public:
Bag<T>^ Clone()

Return Value

The cloned bag.

Remarks

Cloning the bag takes time O(N), where N is the number of unquie items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


CloneContents Method

Bag<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> CloneContents()
Public Function CloneContents As Bag(Of T)
public:
Bag<T>^ CloneContents()

Return Value

The cloned bag.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the bag takes time O(N log N), where N is the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Contains Method

Bag<(Of <(<'T>)>)>..::..Contains Method

Determines if this bag contains an item equal to item. The bag is not changed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the bag contains item. False if the bag does not contain item.

Remarks

Searching the bag for an item takes time O(log N), where N is the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Difference Method

Bag<(Of <(<'T>)>)>..::..Difference Method

Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> Difference(
    Bag<T> otherBag
)
Public Function Difference ( _
    otherBag As Bag(Of T) _
) As Bag(Of T)
public:
Bag<T>^ Difference(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to difference with.

Return Value

The difference of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The difference of two bags is computed in time O(M + N), where M and N are the size of the two bags.

See Also

Bag<(Of <(<'T>)>)> Class


DifferenceWith Method

Bag<(Of <(<'T>)>)>..::..DifferenceWith Method

Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void DifferenceWith(
    Bag<T> otherBag
)
Public Sub DifferenceWith ( _
    otherBag As Bag(Of T) _
)
public:
void DifferenceWith(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to difference with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The difference of two bags is computed in time O(M), where M is the size of the other bag.

See Also

Bag<(Of <(<'T>)>)> Class


DistinctItems Method

Bag<(Of <(<'T>)>)>..::..DistinctItems Method

Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerable<T> DistinctItems()
Public Function DistinctItems As IEnumerable(Of T)
public:
IEnumerable<T>^ DistinctItems()

Return Value

An IEnumerable<T> that enumerates the unique items.

Remarks

If the bag is changed while items are being enumerated, the enumeration will terminate with an InvalidOperationException.

See Also

Bag<(Of <(<'T>)>)> Class


GetEnumerator Method

Bag<(Of <(<'T>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the items in the bag. If an item is present multiple times in the bag, the representative item is yielded by the enumerator multiple times. The order of enumeration is haphazard and may change.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An enumerator for enumerating all the items in the Bag.

Remarks

Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.

If an item is added to or deleted from the bag while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumeration all the items in the bag takes time O(N), where N is the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


GetRepresentativeItem Method

Bag<(Of <(<'T>)>)>..::..GetRepresentativeItem Method

Returns the representative item stored in the bag that is equal to the provided item. Also returns the number of copies of the item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int GetRepresentativeItem(
    T item,
    out T representative
)
Public Function GetRepresentativeItem ( _
    item As T, _
    <OutAttribute> ByRef representative As T _
) As Integer
public:
int^ GetRepresentativeItem(
    T item,
    [OutAttribute] T% representative
)

Parameters

item
Type: T
Item to find in the bag.
representative
Type: T %
If one or more items equal to item are present in the bag, returns the representative item. If no items equal to item are stored in the bag, returns item.

Return Value

The number of items equal to item stored in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Intersection Method

Bag<(Of <(<'T>)>)>..::..Intersection Method

Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the intersection contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> Intersection(
    Bag<T> otherBag
)
Public Function Intersection ( _
    otherBag As Bag(Of T) _
) As Bag(Of T)
public:
Bag<T>^ Intersection(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to intersection with.

Return Value

The intersection of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

When equal items appear in both bags, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.

See Also

Bag<(Of <(<'T>)>)> Class


IntersectionWith Method

Bag<(Of <(<'T>)>)>..::..IntersectionWith Method

Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void IntersectionWith(
    Bag<T> otherBag
)
Public Sub IntersectionWith ( _
    otherBag As Bag(Of T) _
)
public:
void IntersectionWith(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to intersection with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

When equal items appear in both bags, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two bags is computed in time O(N), where N is the size of the smaller bag.

See Also

Bag<(Of <(<'T>)>)> Class


IsDisjointFrom Method

Bag<(Of <(<'T>)>)>..::..IsDisjointFrom Method

Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsDisjointFrom(
    Bag<T> otherBag
)
Public Function IsDisjointFrom ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsDisjointFrom(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to check disjointness with.

Return Value

True if the two bags are disjoint, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The answer is computed in time O(N), where N is the size of the smaller set.

See Also

Bag<(Of <(<'T>)>)> Class


IsEqualTo Method

Bag<(Of <(<'T>)>)>..::..IsEqualTo Method

Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same number of of copies of equal elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsEqualTo(
    Bag<T> otherBag
)
Public Function IsEqualTo ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsEqualTo(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to compare to

Return Value

True if this bag is equal to otherBag, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

IsSupersetOf is computed in time O(N), where N is the number of unique items in this bag.

See Also

Bag<(Of <(<'T>)>)> Class


IsProperSubsetOf Method

Bag<(Of <(<'T>)>)>..::..IsProperSubsetOf Method

Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSubsetOf(
    Bag<T> otherBag
)
Public Function IsProperSubsetOf ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsProperSubsetOf(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to compare to.

Return Value

True if this is a proper subset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

IsProperSubsetOf is computed in time O(N), where N is the number of unique items in this bag.

See Also

Bag<(Of <(<'T>)>)> Class


IsProperSupersetOf Method

Bag<(Of <(<'T>)>)>..::..IsProperSupersetOf Method

Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSupersetOf(
    Bag<T> otherBag
)
Public Function IsProperSupersetOf ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsProperSupersetOf(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a proper superset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

IsProperSupersetOf is computed in time O(M), where M is the number of unique items in otherBag.

See Also

Bag<(Of <(<'T>)>)> Class


IsSubsetOf Method

Bag<(Of <(<'T>)>)>..::..IsSubsetOf Method

Determines if this bag is a subset of another ba11 items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSubsetOf(
    Bag<T> otherBag
)
Public Function IsSubsetOf ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsSubsetOf(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to compare to.

Return Value

True if this is a subset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

See Also

Bag<(Of <(<'T>)>)> Class


IsSupersetOf Method

Bag<(Of <(<'T>)>)>..::..IsSupersetOf Method

Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSupersetOf(
    Bag<T> otherBag
)
Public Function IsSupersetOf ( _
    otherBag As Bag(Of T) _
) As Boolean
public:
bool^ IsSupersetOf(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to compare to.

Return Value

True if this is a superset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

IsSupersetOf is computed in time O(M), where M is the number of unique items in otherBag.

See Also

Bag<(Of <(<'T>)>)> Class


NumberOfCopies Method

Bag<(Of <(<'T>)>)>..::..NumberOfCopies Method

Returns the number of copies of item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int NumberOfCopies(
    T item
)
Public Function NumberOfCopies ( _
    item As T _
) As Integer
public:
int^ NumberOfCopies(
    T item
)

Parameters

item
Type: T
The item to search for in the bag.

Return Value

The number of items in the bag that compare equal to item.

Remarks

NumberOfCopies() takes approximately constant time, no matter how many items are stored in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Remove Method

Bag<(Of <(<'T>)>)>..::..Remove Method

Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the bag.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

Removing an item from the bag takes approximated constant time, regardless of the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


RemoveAllCopies Method

Bag<(Of <(<'T>)>)>..::..RemoveAllCopies Method

Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveAllCopies(
    T item
)
Public Function RemoveAllCopies ( _
    item As T _
) As Integer
public:
int^ RemoveAllCopies(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

The number of copies of item that were found and removed.

Remarks

Equality between items is determined by the comparer instance used to create the bag.

RemoveAllCopies() takes time O(M log N), where N is the total number of items in the bag, and M is the number of items equal to item.

See Also

Bag<(Of <(<'T>)>)> Class


RemoveMany Method

Bag<(Of <(<'T>)>)>..::..RemoveMany Method

Removes all the items in collection from the bag. Items that are not present in the bag are ignored.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<T> collection
)
Public Function RemoveMany ( _
    collection As IEnumerable(Of T) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to remove from the bag.

Return Value

The number of items removed from the bag.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Equality between items is determined by the comparer instance used to create the bag.

Removing the collection takes time O(M), where M is the number of items in collection.

See Also

Bag<(Of <(<'T>)>)> Class


Sum Method

Bag<(Of <(<'T>)>)>..::..Sum Method

Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> Sum(
    Bag<T> otherBag
)
Public Function Sum ( _
    otherBag As Bag(Of T) _
) As Bag(Of T)
public:
Bag<T>^ Sum(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to sum with.

Return Value

The sum of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The sum of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

Bag<(Of <(<'T>)>)> Class


SumWith Method

Bag<(Of <(<'T>)>)>..::..SumWith Method

Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SumWith(
    Bag<T> otherBag
)
Public Sub SumWith ( _
    otherBag As Bag(Of T) _
)
public:
void SumWith(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to sum with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The sum of two bags is computed in time O(M), where M is the size of the other bag..

See Also

Bag<(Of <(<'T>)>)> Class


SymmetricDifference Method

Bag<(Of <(<'T>)>)>..::..SymmetricDifference Method

Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> SymmetricDifference(
    Bag<T> otherBag
)
Public Function SymmetricDifference ( _
    otherBag As Bag(Of T) _
) As Bag(Of T)
public:
Bag<T>^ SymmetricDifference(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to symmetric difference with.

Return Value

The symmetric difference of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The symmetric difference of two bags is computed in time O(M + N), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

Bag<(Of <(<'T>)>)> Class


SymmetricDifferenceWith Method

Bag<(Of <(<'T>)>)>..::..SymmetricDifferenceWith Method

Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y) times. This bag receives the symmetric difference of the two bags; the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SymmetricDifferenceWith(
    Bag<T> otherBag
)
Public Sub SymmetricDifferenceWith ( _
    otherBag As Bag(Of T) _
)
public:
void SymmetricDifferenceWith(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to symmetric difference with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The symmetric difference of two bags is computed in time O(M + N), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

Bag<(Of <(<'T>)>)> Class


Union Method

Bag<(Of <(<'T>)>)>..::..Union Method

Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Bag<T> Union(
    Bag<T> otherBag
)
Public Function Union ( _
    otherBag As Bag(Of T) _
) As Bag(Of T)
public:
Bag<T>^ Union(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to union with.

Return Value

The union of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The union of two bags is computed in time O(M+N), where M and N are the size of the two bags.

See Also

Bag<(Of <(<'T>)>)> Class


UnionWith Method

Bag<(Of <(<'T>)>)>..::..UnionWith Method

Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void UnionWith(
    Bag<T> otherBag
)
Public Sub UnionWith ( _
    otherBag As Bag(Of T) _
)
public:
void UnionWith(
    Bag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..Bag <(Of <(<' T >)>)>
Bag to union with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The union of two bags is computed in time O(M+N), where M and N are the size of the two bags.

See Also

Bag<(Of <(<'T>)>)> Class


Bag(T) Properties

Bag<(Of <(<'T>)>)> Properties

The Bag<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Comparer | Returns the IEqualityComparer<T> used to compare items in this bag.
Public property | Count | Returns the number of items in the bag.

See Also

Bag<(Of <(<'T>)>)> Class


Comparer Property

Bag<(Of <(<'T>)>)>..::..Comparer Property

Returns the IEqualityComparer<T> used to compare items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEqualityComparer<T> Comparer { get; }
Public ReadOnly Property Comparer As IEqualityComparer(Of T)
    Get
public:
property IEqualityComparer<T>^ Comparer {
    IEqualityComparer<T>^ get ();
}

Field Value

If the bag was created using a comparer, that comparer is returned. Otherwise the default comparer for T (EqualityComparer<T>.Default) is returned.

See Also

Bag<(Of <(<'T>)>)> Class


Count Property

Bag<(Of <(<'T>)>)>..::..Count Property

Returns the number of items in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the bag.

Remarks

The size of the bag is returned in constant time.

See Also

Bag<(Of <(<'T>)>)> Class


BigList(T) Class

BigList<(Of <(<'T>)>)> Class

BigList<T> provides a list of items, in order, with indices of the items ranging from 0 to one less than the count of items in the collection. BigList<T> is optimized for efficient operations on large (>100 items) lists, especially for insertions, deletions, copies, and concatinations.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class BigList<T> : ListBase<T>

<SerializableAttribute> _
Public Class BigList(Of T) _
    Inherits ListBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class BigList : public ListBase<T>

Type Parameters

T
The type of items to store in the BigList.

Remarks

BigList<T> class is similar in functionality to the standard List<T> class. Both classes provide a collection that stores an set of items in order, with indices of the items ranging from 0 to one less than the count of items in the collection. Both classes provide the ability to add and remove items from any index, and the get or set the item at any index.

BigList<T> differs significantly from List<T> in the performance of various operations, especially when the lists become large (several hundred items or more). With List<T>, inserting or removing elements from anywhere in a large list except the end is very inefficient -- every item after the point of inserting or deletion has to be moved in the list. The BigList<T> class, however, allows for fast insertions and deletions anywhere in the list. Furthermore, BigList<T> allows copies of a list, sub-parts of a list, and concatinations of two lists to be very fast. When a copy is made of part or all of a BigList, two lists shared storage for the parts of the lists that are the same. Only when one of the lists is changed is additional memory allocated to store the distinct parts of the lists.

Of course, there is a small price to pay for this extra flexibility. Although still quite efficient, using an index to get or change one element of a BigList, while still reasonably efficient, is significantly slower than using a plain List. Because of this, if you want to process every element of a BigList, using a foreach loop is a lot more efficient than using a for loop and indexing the list.

In general, use a List when the only operations you are using are Add (to the end), foreach, or indexing, or you are very sure the list will always remain small (less than 100 items). For large (>100 items) lists that do insertions, removals, copies, concatinations, or sub-ranges, BigList will be more efficient than List. In almost all cases, BigList is more efficient and easier to use than LinkedList.

Inheritance Hierarchy

Wintellect.PowerCollections..::..CollectionBase <(Of <(<' T >)>)>
Wintellect.PowerCollections..::..ListBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..BigList<(Of <(<'T>)>)>

See Also

BigList<(Of <(<'T>)>)> Members


BigList(T) Members

BigList<(Of <(<'T>)>)> Members

The BigList<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | BigList<(Of <(<'T>)>)>()()()() | Creates a new BigList. The BigList is initially empty.
Public method | BigList<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new BigList initialized with the items from collection, in order.
Public method | BigList<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Int32) | Creates a new BigList initialized with a given number of copies of the items from collection, in order.
Public method | BigList<(Of <(<'T>)>)>(BigList<(Of <<'(T>)>>)) | Creates a new BigList that is a copy of list.
Public method | BigList<(Of <(<'T>)>)>(BigList<(Of <<'(T>)>>), Int32) | Creates a new BigList that is several copies of list.

Methods

 | Name | Description
Public method | Add | Adds an item to the end of the BigList. The indices of all existing items in the Deque are unchanged.
Public method | AddRange(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the end of BigList. The indices of all existing items are unchanged. The last item in the added collection becomes the last item in the BigList.
Public method | AddRange(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the end of BigList. The indices of all existing items are unchanged. The last item in list becomes the last item in this list. The added list list is unchanged.
Public method | AddRangeToFront(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the front of BigList. The indices of all existing items in the are increased by the number of items in collection. The first item in the added collection becomes the first item in the BigList.
Public method | AddRangeToFront(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the front of BigList. The indices of all existing items are increased by the number of items in list. The first item in list becomes the first item in this list. The added list list is unchanged.
Public method | AddToFront | Adds an item to the beginning of the BigList. The indices of all existing items in the Deque are increased by one, and the new item has index zero.
Public method | BinarySearch(T) | Searches a sorted list for an item via binary search. The list must be sorted in the order defined by the default ordering of the item type; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, IComparer<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed IComparer<T> interface; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, Comparison<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed Comparison<T> delegate; otherwise, incorrect results will be returned.
Public method | Clear | Removes all of the items from the BigList.
Public method | Clone | Creates a new BigList that is a copy of this list.
Public method | CloneContents | Makes a deep clone of this BigList. A new BigList is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then this method is the same as Clone.
Public method | ConvertAll<(Of <<'(TDest>)>>) | Convert the list to a new list by applying a delegate to each item in the collection. The resulting list contains the result of applying converter to each item in the list, in order. The current list is unchanged.
Public method | GetEnumerator()()()() | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. Usually, the foreach statement is used to call this method implicitly.
Public method | GetRange | Creates a new list that contains a subrange of elements from this list. The current list is unchanged.
Public method | Insert | Inserts a new item at the given index in the BigList. All items at indexes equal to or greater than index move up one index.
Public method | InsertRange(Int32, IEnumerable<(Of <<'(T>)>>)) | Inserts a collection of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public method | InsertRange(Int32, BigList<(Of <<'(T>)>>)) | Inserts a BigList of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public method | Print | Prints out the internal structure of the tree, for debugging purposes.
Public method | Range | Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Public method | RemoveAt | Removes the item at the given index in the BigList. All items at indexes greater than index move down one index.
Public method | RemoveRange | Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.
Public method | Reverse()()()() | Reverses the current list in place.
Public method | Reverse(Int32, Int32) | Reverses the items in the range of count items starting from startIndex, in place.
Public method | Sort()()()() | Sorts the list in place.
Public method | Sort(IComparer<(Of <<'(T>)>>)) | Sorts the list in place. A supplied IComparer<T> is used to compare the items in the list.
Public method | Sort(Comparison<(Of <<'(T>)>>)) | Sorts the list in place. A supplied Comparison<T> delegate is used to compare the items in the list.
Public method | Validate | Attempts to validate the internal consistency of the tree.

Operators

Name | Description
Addition | Concatenates two lists together to create a new list. Both lists being concatenated are unchanged. The resulting list contains all the items in first, followed by all the items in second.

Properties

 | Name | Description
Public property | Count | Gets the number of items stored in the BigList. The indices of the items range from 0 to Count-1.
Public property | Item | Gets or sets an item in the list, by index.

See Also

BigList<(Of <(<'T>)>)> Class


BigList(T) Constructor

BigList<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | BigList<(Of <(<'T>)>)>()()()() | Creates a new BigList. The BigList is initially empty.
Public method | BigList<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new BigList initialized with the items from collection, in order.
Public method | BigList<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Int32) | Creates a new BigList initialized with a given number of copies of the items from collection, in order.
Public method | BigList<(Of <(<'T>)>)>(BigList<(Of <<'(T>)>>)) | Creates a new BigList that is a copy of list.
Public method | BigList<(Of <(<'T>)>)>(BigList<(Of <<'(T>)>>), Int32) | Creates a new BigList that is several copies of list.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


BigList(T) Constructor

BigList<(Of <(<'T>)>)> Constructor

Creates a new BigList. The BigList is initially empty.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList()
Public Sub New
public:
BigList()

Remarks

Creating a empty BigList takes constant time and consumes a very small amount of memory.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Overload


BigList(T) Constructor (IEnumerable(T))

BigList<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Creates a new BigList initialized with the items from collection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
BigList(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection used to initialize the BigList.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Initializing the tree list with the elements of collection takes time O(N), where N is the number of items in collection.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Overload


BigList(T) Constructor (IEnumerable(T), Int32)

BigList<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, Int32)

Creates a new BigList initialized with a given number of copies of the items from collection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList(
    IEnumerable<T> collection,
    int copies
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    copies As Integer _
)
public:
BigList(
    IEnumerable<T>^ collection,
    int^ copies
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection used to initialize the BigList.
copies
Type: Int32
Number of copies of the collection to use.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | copies is negative.
ArgumentNullException | collection is null.

Remarks

Initializing the tree list with the elements of collection takes time O(N + log K), where N is the number of items in collection, and K is the number of copies.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Overload


BigList(T) Constructor (BigList(T))

BigList<(Of <(<'T>)>)> Constructor (BigList<(Of <(<'T>)>)>)

Creates a new BigList that is a copy of list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList(
    BigList<T> list
)
Public Sub New ( _
    list As BigList(Of T) _
)
public:
BigList(
    BigList<T>^ list
)

Parameters

list
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The BigList to copy.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

Copying a BigList takes constant time, and little additional memory, since the storage for the items of the two lists is shared. However, changing either list will take additional time and memory. Portions of the list are copied when they are changed.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Overload


BigList(T) Constructor (BigList(T), Int32)

BigList<(Of <(<'T>)>)> Constructor (BigList<(Of <(<'T>)>)>, Int32)

Creates a new BigList that is several copies of list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList(
    BigList<T> list,
    int copies
)
Public Sub New ( _
    list As BigList(Of T), _
    copies As Integer _
)
public:
BigList(
    BigList<T>^ list,
    int^ copies
)

Parameters

list
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The BigList to copy.
copies
Type: Int32
Number of copies of the collection to use.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

Creating K copies of a BigList takes time O(log K), and O(log K) additional memory, since the storage for the items of the two lists is shared. However, changing either list will take additional time and memory. Portions of the list are copied when they are changed.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Overload


BigList(T) Methods

BigList<(Of <(<'T>)>)> Methods

The BigList<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds an item to the end of the BigList. The indices of all existing items in the Deque are unchanged.
Public method | AddRange(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the end of BigList. The indices of all existing items are unchanged. The last item in the added collection becomes the last item in the BigList.
Public method | AddRange(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the end of BigList. The indices of all existing items are unchanged. The last item in list becomes the last item in this list. The added list list is unchanged.
Public method | AddRangeToFront(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the front of BigList. The indices of all existing items in the are increased by the number of items in collection. The first item in the added collection becomes the first item in the BigList.
Public method | AddRangeToFront(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the front of BigList. The indices of all existing items are increased by the number of items in list. The first item in list becomes the first item in this list. The added list list is unchanged.
Public method | AddToFront | Adds an item to the beginning of the BigList. The indices of all existing items in the Deque are increased by one, and the new item has index zero.
Public method | BinarySearch(T) | Searches a sorted list for an item via binary search. The list must be sorted in the order defined by the default ordering of the item type; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, IComparer<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed IComparer<T> interface; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, Comparison<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed Comparison<T> delegate; otherwise, incorrect results will be returned.
Public method | Clear | Removes all of the items from the BigList.
Public method | Clone | Creates a new BigList that is a copy of this list.
Public method | CloneContents | Makes a deep clone of this BigList. A new BigList is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then this method is the same as Clone.
Public method | ConvertAll<(Of <<'(TDest>)>>) | Convert the list to a new list by applying a delegate to each item in the collection. The resulting list contains the result of applying converter to each item in the list, in order. The current list is unchanged.
Public method | GetEnumerator()()()() | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. Usually, the foreach statement is used to call this method implicitly.
Public method | GetRange | Creates a new list that contains a subrange of elements from this list. The current list is unchanged.
Public method | Insert | Inserts a new item at the given index in the BigList. All items at indexes equal to or greater than index move up one index.
Public method | InsertRange(Int32, IEnumerable<(Of <<'(T>)>>)) | Inserts a collection of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public method | InsertRange(Int32, BigList<(Of <<'(T>)>>)) | Inserts a BigList of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public method | Print | Prints out the internal structure of the tree, for debugging purposes.
Public method | Range | Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Public method | RemoveAt | Removes the item at the given index in the BigList. All items at indexes greater than index move down one index.
Public method | RemoveRange | Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.
Public method | Reverse()()()() | Reverses the current list in place.
Public method | Reverse(Int32, Int32) | Reverses the items in the range of count items starting from startIndex, in place.
Public method | Sort()()()() | Sorts the list in place.
Public method | Sort(IComparer<(Of <<'(T>)>>)) | Sorts the list in place. A supplied IComparer<T> is used to compare the items in the list.
Public method | Sort(Comparison<(Of <<'(T>)>>)) | Sorts the list in place. A supplied Comparison<T> delegate is used to compare the items in the list.
Public method | Validate | Attempts to validate the internal consistency of the tree.

See Also

BigList<(Of <(<'T>)>)> Class


Add Method

BigList<(Of <(<'T>)>)>..::..Add Method

Adds an item to the end of the BigList. The indices of all existing items in the Deque are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add.

Remarks

Adding an item takes, on average, constant time.

See Also

BigList<(Of <(<'T>)>)> Class


AddRange Method

BigList<(Of <(<'T>)>)>..::..AddRange Method

Overload List

 | Name | Description
Public method | AddRange(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the end of BigList. The indices of all existing items are unchanged. The last item in the added collection becomes the last item in the BigList.
Public method | AddRange(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the end of BigList. The indices of all existing items are unchanged. The last item in list becomes the last item in this list. The added list list is unchanged.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


AddRange Method (IEnumerable(T))

BigList<(Of <(<'T>)>)>..::..AddRange Method (IEnumerable<(Of <(<'T>)>)>)

Adds a collection of items to the end of BigList. The indices of all existing items are unchanged. The last item in the added collection becomes the last item in the BigList.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddRange(
    IEnumerable<T> collection
)
Public Sub AddRange ( _
    collection As IEnumerable(Of T) _
)
public:
void AddRange(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of items to add.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

This method takes time O(M + log N), where M is the number of items in the collection, and N is the size of the BigList.

See Also

BigList<(Of <(<'T>)>)> Class
AddRange Overload


AddRange Method (BigList(T))

BigList<(Of <(<'T>)>)>..::..AddRange Method (BigList<(Of <(<'T>)>)>)

Adds a BigList of items to the end of BigList. The indices of all existing items are unchanged. The last item in list becomes the last item in this list. The added list list is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddRange(
    BigList<T> list
)
Public Sub AddRange ( _
    list As BigList(Of T) _
)
public:
void AddRange(
    BigList<T>^ list
)

Parameters

list
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The list of items to add.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

This method takes, on average, constant time, regardless of the size of either list. Although conceptually all of the items in list are copied, storage is shared between the two lists until changes are made to the shared sections.

See Also

BigList<(Of <(<'T>)>)> Class
AddRange Overload


AddRangeToFront Method

BigList<(Of <(<'T>)>)>..::..AddRangeToFront Method

Overload List

 | Name | Description
Public method | AddRangeToFront(IEnumerable<(Of <<'(T>)>>)) | Adds a collection of items to the front of BigList. The indices of all existing items in the are increased by the number of items in collection. The first item in the added collection becomes the first item in the BigList.
Public method | AddRangeToFront(BigList<(Of <<'(T>)>>)) | Adds a BigList of items to the front of BigList. The indices of all existing items are increased by the number of items in list. The first item in list becomes the first item in this list. The added list list is unchanged.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


AddRangeToFront Method (IEnumerable(T))

BigList<(Of <(<'T>)>)>..::..AddRangeToFront Method (IEnumerable<(Of <(<'T>)>)>)

Adds a collection of items to the front of BigList. The indices of all existing items in the are increased by the number of items in collection. The first item in the added collection becomes the first item in the BigList.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddRangeToFront(
    IEnumerable<T> collection
)
Public Sub AddRangeToFront ( _
    collection As IEnumerable(Of T) _
)
public:
void AddRangeToFront(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of items to add.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

This method takes time O(M + log N), where M is the number of items in the collection, and N is the size of the BigList.

See Also

BigList<(Of <(<'T>)>)> Class
AddRangeToFront Overload


AddRangeToFront Method (BigList(T))

BigList<(Of <(<'T>)>)>..::..AddRangeToFront Method (BigList<(Of <(<'T>)>)>)

Adds a BigList of items to the front of BigList. The indices of all existing items are increased by the number of items in list. The first item in list becomes the first item in this list. The added list list is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddRangeToFront(
    BigList<T> list
)
Public Sub AddRangeToFront ( _
    list As BigList(Of T) _
)
public:
void AddRangeToFront(
    BigList<T>^ list
)

Parameters

list
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The list of items to add.

Exceptions

Exception | Condition
ArgumentNullException | list is null.

Remarks

This method takes, on average, constant time, regardless of the size of either list. Although conceptually all of the items in list are copied, storage is shared between the two lists until changes are made to the shared sections.

See Also

BigList<(Of <(<'T>)>)> Class
AddRangeToFront Overload


AddToFront Method

BigList<(Of <(<'T>)>)>..::..AddToFront Method

Adds an item to the beginning of the BigList. The indices of all existing items in the Deque are increased by one, and the new item has index zero.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddToFront(
    T item
)
Public Sub AddToFront ( _
    item As T _
)
public:
void AddToFront(
    T item
)

Parameters

item
Type: T
The item to add.

Remarks

Adding an item takes, on average, constant time.

See Also

BigList<(Of <(<'T>)>)> Class


BinarySearch Method

BigList<(Of <(<'T>)>)>..::..BinarySearch Method

Overload List

 | Name | Description
Public method | BinarySearch(T) | Searches a sorted list for an item via binary search. The list must be sorted in the order defined by the default ordering of the item type; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, IComparer<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed IComparer<T> interface; otherwise, incorrect results will be returned.
Public method | BinarySearch(T, Comparison<(Of <<'(T>)>>)) | Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed Comparison<T> delegate; otherwise, incorrect results will be returned.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


BinarySearch Method (T)

BigList<(Of <(<'T>)>)>..::..BinarySearch Method (T)

Searches a sorted list for an item via binary search. The list must be sorted in the order defined by the default ordering of the item type; otherwise, incorrect results will be returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int BinarySearch(
    T item
)
Public Function BinarySearch ( _
    item As T _
) As Integer
public:
int^ BinarySearch(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

Returns the index of the first occurence of item in the list. If the item does not occur in the list, the bitwise complement of the first item larger than item in the list is returned. If no item is larger than item, the bitwise complement of Count is returned.

Exceptions

Exception | Condition
InvalidOperationException | The type T does not implement either the IComparable or IComparable<T> interfaces.

See Also

BigList<(Of <(<'T>)>)> Class
BinarySearch Overload


BinarySearch Method (T, IComparer(T))

BigList<(Of <(<'T>)>)>..::..BinarySearch Method (T, IComparer<(Of <(<'T>)>)>)

Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed IComparer<T> interface; otherwise, incorrect results will be returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int BinarySearch(
    T item,
    IComparer<T> comparer
)
Public Function BinarySearch ( _
    item As T, _
    comparer As IComparer(Of T) _
) As Integer
public:
int^ BinarySearch(
    T item,
    IComparer<T>^ comparer
)

Parameters

item
Type: T
The item to search for.
comparer
Type: IComparer <(Of <(<' T >)>)>
The IComparer<T> interface used to sort the list.

Return Value

Returns the index of the first occurence of item in the list. If the item does not occur in the list, the bitwise complement of the first item larger than item in the list is returned. If no item is larger than item, the bitwise complement of Count is returned.

See Also

BigList<(Of <(<'T>)>)> Class
BinarySearch Overload


BinarySearch Method (T, Comparison(T))

BigList<(Of <(<'T>)>)>..::..BinarySearch Method (T, Comparison<(Of <(<'T>)>)>)

Searches a sorted list for an item via binary search. The list must be sorted by the ordering defined by the passed Comparison<T> delegate; otherwise, incorrect results will be returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int BinarySearch(
    T item,
    Comparison<T> comparison
)
Public Function BinarySearch ( _
    item As T, _
    comparison As Comparison(Of T) _
) As Integer
public:
int^ BinarySearch(
    T item,
    Comparison<T>^ comparison
)

Parameters

item
Type: T
The item to search for.
comparison
Type: Comparison <(Of <(<' T >)>)>
The comparison delegate used to sort the list.

Return Value

Returns the index of the first occurence of item in the list. If the item does not occur in the list, the bitwise complement of the first item larger than item in the list is returned. If no item is larger than item, the bitwise complement of Count is returned.

See Also

BigList<(Of <(<'T>)>)> Class
BinarySearch Overload


Clear Method

BigList<(Of <(<'T>)>)>..::..Clear Method

Removes all of the items from the BigList.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing a BigList takes constant time.

See Also

BigList<(Of <(<'T>)>)> Class


Clone Method

BigList<(Of <(<'T>)>)>..::..Clone Method

Creates a new BigList that is a copy of this list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList<T> Clone()
Public Function Clone As BigList(Of T)
public:
BigList<T>^ Clone()

Return Value

A copy of the current list

Remarks

Copying a BigList takes constant time, and little additional memory, since the storage for the items of the two lists is shared. However, changing either list will take additional time and memory. Portions of the list are copied when they are changed.

See Also

BigList<(Of <(<'T>)>)> Class


CloneContents Method

BigList<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this BigList. A new BigList is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then this method is the same as Clone.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList<T> CloneContents()
Public Function CloneContents As BigList(Of T)
public:
BigList<T>^ CloneContents()

Return Value

The cloned set.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

If T is a reference type, cloning the list takes time approximate O(N), where N is the number of items in the list.

See Also

BigList<(Of <(<'T>)>)> Class


ConvertAll(TDest) Method

BigList<(Of <(<'T>)>)>..::..ConvertAll<(Of <(<'TDest>)>)> Method

Convert the list to a new list by applying a delegate to each item in the collection. The resulting list contains the result of applying converter to each item in the list, in order. The current list is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList<TDest> ConvertAll<TDest>(
    Converter<T, TDest> converter
)

Public Function ConvertAll(Of TDest) ( _
    converter As Converter(Of T, TDest) _
) As BigList(Of TDest)
public:
generic<typename TDest>
BigList<TDest>^ ConvertAll(
    Converter<T, TDest>^ converter
)

Type Parameters

TDest
The type each item is being converted to.

Parameters

converter
Type: Converter <(Of <(<' T, TDest>)>)>
A delegate to the method to call, passing each item in sourceCollection.

Return Value

The resulting BigList from applying converter to each item in this list.

Exceptions

Exception | Condition
ArgumentNullException | converter is null.

See Also

BigList<(Of <(<'T>)>)> Class


GetEnumerator Method

BigList<(Of <(<'T>)>)>..::..GetEnumerator Method

Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. Usually, the foreach statement is used to call this method implicitly.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> that enumerates all the items in the list.

Remarks

Enumerating all of the items in the list take time O(N), where N is the number of items in the list. Using GetEnumerator() or foreach is much more efficient than accessing all items by index.

See Also

BigList<(Of <(<'T>)>)> Class
GetEnumerator Overload


GetRange Method

BigList<(Of <(<'T>)>)>..::..GetRange Method

Creates a new list that contains a subrange of elements from this list. The current list is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public BigList<T> GetRange(
    int index,
    int count
)
Public Function GetRange ( _
    index As Integer, _
    count As Integer _
) As BigList(Of T)
public:
BigList<T>^ GetRange(
    int^ index,
    int^ count
)

Parameters

index
Type: Int32
The starting index of the sub-range.
count
Type: Int32
The number of items in the sub-range. If this is zero, the returned list is empty.

Return Value

A new list with the count items that start at index.

Remarks

This method takes take O(log N), where N is the size of the current list. Although the sub-range is conceptually copied, storage is shared between the two lists until a change is made to the shared items.

Remarks

If a view of a sub-range is desired, instead of a copy, use the more efficient Range(Int32, Int32) method, which provides a view onto a sub-range of items.

See Also

BigList<(Of <(<'T>)>)> Class


Insert Method

BigList<(Of <(<'T>)>)>..::..Insert Method

Inserts a new item at the given index in the BigList. All items at indexes equal to or greater than index move up one index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Insert(
    int index,
    T item
)
Public Sub Insert ( _
    index As Integer, _
    item As T _
)
public:
void Insert(
    int^ index,
    T item
)

Parameters

index
Type: Int32
The index to insert the item at. After the insertion, the inserted item is located at this index. The first item has index 0.
item
Type: T
The item to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.

Remarks

The amount of time to insert an item is O(log N), no matter where in the list the insertion occurs. Inserting an item at the beginning or end of the list is O(N).

See Also

BigList<(Of <(<'T>)>)> Class


InsertRange Method

BigList<(Of <(<'T>)>)>..::..InsertRange Method

Overload List

 | Name | Description
Public method | InsertRange(Int32, IEnumerable<(Of <<'(T>)>>)) | Inserts a collection of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.
Public method | InsertRange(Int32, BigList<(Of <<'(T>)>>)) | Inserts a BigList of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


InsertRange Method (Int32, IEnumerable(T))

BigList<(Of <(<'T>)>)>..::..InsertRange Method (Int32, IEnumerable<(Of <(<'T>)>)>)

Inserts a collection of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void InsertRange(
    int index,
    IEnumerable<T> collection
)
Public Sub InsertRange ( _
    index As Integer, _
    collection As IEnumerable(Of T) _
)
public:
void InsertRange(
    int^ index,
    IEnumerable<T>^ collection
)

Parameters

index
Type: Int32
The index to insert the collection at. After the insertion, the first item of the inserted collection is located at this index. The first item has index 0.
collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of items to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.
ArgumentNullException | collection is null.

Remarks

The amount of time to insert an arbitrary collection in the BigList is O(M + log N), where M is the number of items inserted, and N is the number of items in the list.

See Also

BigList<(Of <(<'T>)>)> Class
InsertRange Overload


InsertRange Method (Int32, BigList(T))

BigList<(Of <(<'T>)>)>..::..InsertRange Method (Int32, BigList<(Of <(<'T>)>)>)

Inserts a BigList of items at the given index in the BigList. All items at indexes equal to or greater than index increase their indices by the number of items inserted.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void InsertRange(
    int index,
    BigList<T> list
)
Public Sub InsertRange ( _
    index As Integer, _
    list As BigList(Of T) _
)
public:
void InsertRange(
    int^ index,
    BigList<T>^ list
)

Parameters

index
Type: Int32
The index to insert the collection at. After the insertion, the first item of the inserted collection is located at this index. The first item has index 0.
list
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The BigList of items to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.
ArgumentNullException | list is null.

Remarks

The amount of time to insert another BigList is O(log N), where N is the number of items in the list, regardless of the number of items in the inserted list. Storage is shared between the two lists until one of them is changed.

See Also

BigList<(Of <(<'T>)>)> Class
InsertRange Overload


Print Method

BigList<(Of <(<'T>)>)>..::..Print Method

Prints out the internal structure of the tree, for debugging purposes.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Print()
Public Sub Print
public:
void Print()

See Also

BigList<(Of <(<'T>)>)> Class


Range Method

BigList<(Of <(<'T>)>)>..::..Range Method

Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IList<T> Range(
    int index,
    int count
)
Public Function Range ( _
    index As Integer, _
    count As Integer _
) As IList(Of T)
public:
IList<T>^ Range(
    int^ index,
    int^ count
)

Parameters

index
Type: Int32
The starting index of the view.
count
Type: Int32
The number of items in the view.

Return Value

A list that is a view onto the given sub-list.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index or count is negative.
ArgumentOutOfRangeException | index + count is greater than the size of this list.

Remarks

If a copy of the sub-range is desired, use the GetRange(Int32, Int32) method instead.

This method can be used to apply an algorithm to a portion of a list. For example:

C#
Algorithms.ReverseInPlace(list.Range(3, 6))
 will reverse the 6 items beginning at index 3.

See Also

BigList<(Of <(<'T>)>)> Class


RemoveAt Method

BigList<(Of <(<'T>)>)>..::..RemoveAt Method

Removes the item at the given index in the BigList. All items at indexes greater than index move down one index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void RemoveAt(
    int index
)
Public Sub RemoveAt ( _
    index As Integer _
)
public:
void RemoveAt(
    int^ index
)

Parameters

index
Type: Int32
The index in the list to remove the item at. The first item in the list has index 0.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The amount of time to delete an item in the BigList is O(log N), where N is the number of items in the list.

See Also

BigList<(Of <(<'T>)>)> Class


RemoveRange Method

BigList<(Of <(<'T>)>)>..::..RemoveRange Method

Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void RemoveRange(
    int index,
    int count
)
Public Sub RemoveRange ( _
    index As Integer, _
    count As Integer _
)
public:
void RemoveRange(
    int^ index,
    int^ count
)

Parameters

index
Type: Int32
The index in the list to remove the range at. The first item in the list has index 0.
count
Type: Int32
The number of items to remove.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count, or count is less than zero or too large.

Remarks

The amount of time to delete count items in the Deque is proportional to the distance of index from the closest end of the Deque, plus count: O(count + Min(index, Count - 1 - index)).

See Also

BigList<(Of <(<'T>)>)> Class


Reverse Method

BigList<(Of <(<'T>)>)>..::..Reverse Method

Overload List

 | Name | Description
Public method | Reverse()()()() | Reverses the current list in place.
Public method | Reverse(Int32, Int32) | Reverses the items in the range of count items starting from startIndex, in place.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


Reverse Method

BigList<(Of <(<'T>)>)>..::..Reverse Method

Reverses the current list in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Reverse()
Public Sub Reverse
public:
void Reverse()

See Also

BigList<(Of <(<'T>)>)> Class
Reverse Overload


Reverse Method (Int32, Int32)

BigList<(Of <(<'T>)>)>..::..Reverse Method (Int32, Int32)

Reverses the items in the range of count items starting from startIndex, in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Reverse(
    int start,
    int count
)
Public Sub Reverse ( _
    start As Integer, _
    count As Integer _
)
public:
void Reverse(
    int^ start,
    int^ count
)

Parameters

start
Type: Int32
The starting index of the range to reverse.
count
Type: Int32
The number of items in range to reverse.

See Also

BigList<(Of <(<'T>)>)> Class
Reverse Overload


Sort Method

BigList<(Of <(<'T>)>)>..::..Sort Method

Overload List

 | Name | Description
Public method | Sort()()()() | Sorts the list in place.
Public method | Sort(IComparer<(Of <<'(T>)>>)) | Sorts the list in place. A supplied IComparer<T> is used to compare the items in the list.
Public method | Sort(Comparison<(Of <<'(T>)>>)) | Sorts the list in place. A supplied Comparison<T> delegate is used to compare the items in the list.

See Also

BigList<(Of <(<'T>)>)> Class
BigList<(Of <(<'T>)>)> Members


Sort Method

BigList<(Of <(<'T>)>)>..::..Sort Method

Sorts the list in place.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Sort()
Public Sub Sort
public:
void Sort()

Exceptions

Exception | Condition
InvalidOperationException | The type T does not implement either the IComparable or IComparable<T> interfaces.

Remarks

The Quicksort algorithm is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

Values are compared by using the IComparable or IComparable<T> interface implementation on the type T.

See Also

BigList<(Of <(<'T>)>)> Class
Sort Overload


Sort Method (IComparer(T))

BigList<(Of <(<'T>)>)>..::..Sort Method (IComparer<(Of <(<'T>)>)>)

Sorts the list in place. A supplied IComparer<T> is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Sort(
    IComparer<T> comparer
)
Public Sub Sort ( _
    comparer As IComparer(Of T) _
)
public:
void Sort(
    IComparer<T>^ comparer
)

Parameters

comparer
Type: IComparer <(Of <(<' T >)>)>
The comparer instance used to compare items in the collection. Only the Compare method is used.

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

See Also

BigList<(Of <(<'T>)>)> Class
Sort Overload


Sort Method (Comparison(T))

BigList<(Of <(<'T>)>)>..::..Sort Method (Comparison<(Of <(<'T>)>)>)

Sorts the list in place. A supplied Comparison<T> delegate is used to compare the items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Sort(
    Comparison<T> comparison
)
Public Sub Sort ( _
    comparison As Comparison(Of T) _
)
public:
void Sort(
    Comparison<T>^ comparison
)

Parameters

comparison
Type: Comparison <(Of <(<' T >)>)>
The comparison delegate used to compare items in the collection.

Remarks

The Quicksort algorithms is used to sort the items. In virtually all cases, this takes time O(N log N), where N is the number of items in the list.

See Also

BigList<(Of <(<'T>)>)> Class
Sort Overload


Validate Method

BigList<(Of <(<'T>)>)>..::..Validate Method

Attempts to validate the internal consistency of the tree.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Validate()
Public Sub Validate
public:
void Validate()

See Also

BigList<(Of <(<'T>)>)> Class


BigList(T) Operators

BigList<(Of <(<'T>)>)> Operators

The BigList<(Of <(<'T>)>)> type exposes the following members.

Operators

Name | Description
Addition | Concatenates two lists together to create a new list. Both lists being concatenated are unchanged. The resulting list contains all the items in first, followed by all the items in second.

See Also

BigList<(Of <(<'T>)>)> Class


Addition Operator

BigList<(Of <(<'T>)>)>..::..Addition Operator

Concatenates two lists together to create a new list. Both lists being concatenated are unchanged. The resulting list contains all the items in first, followed by all the items in second.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static BigList<T> operator +(
    BigList<T> first,
    BigList<T> second
)
Public Shared Operator + ( _
    first As BigList(Of T), _
    second As BigList(Of T) _
) As BigList(Of T)
public:
static BigList<T>^ operator +(
    BigList<T>^ first,
    BigList<T>^ second
)

Parameters

first
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The first list to concatenate.
second
Type: Wintellect.PowerCollections..::..BigList <(Of <(<' T >)>)>
The second list to concatenate.

Exceptions

Exception | Condition
ArgumentNullException | first or second is null.

Remarks

This method takes, on average, constant time, regardless of the size of either list. Although conceptually all of the items in both lists are copied, storage is shared until changes are made to the shared sections.

See Also

BigList<(Of <(<'T>)>)> Class


BigList(T) Properties

BigList<(Of <(<'T>)>)> Properties

The BigList<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Gets the number of items stored in the BigList. The indices of the items range from 0 to Count-1.
Public property | Item | Gets or sets an item in the list, by index.

See Also

BigList<(Of <(<'T>)>)> Class


Count Property

BigList<(Of <(<'T>)>)>..::..Count Property

Gets the number of items stored in the BigList. The indices of the items range from 0 to Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the BigList.

Remarks

Getting the number of items in the BigList takes constant time.

See Also

BigList<(Of <(<'T>)>)> Class


Item Property

BigList<(Of <(<'T>)>)>..::..Item Property

Gets or sets an item in the list, by index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; set; }
Public Default Property Item ( _
    index As Integer _
) As T
    Get
    Set
public:
property T default[int^ index] {
    T get (int^ index);
    void set (int^ index, T value);
}

Parameters

index
Type: Int32
The index of the item to get or set. The first item in the list has index 0, the last item has index Count-1.

Return Value

The value of the item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

Gettingor setting an item takes time O(log N), where N is the number of items in the list.

To process each of the items in the list, using GetEnumerator() or a foreach loop is more efficient that accessing each of the elements by index.

See Also

BigList<(Of <(<'T>)>)> Class


BinaryPredicate(T) Delegate

BinaryPredicate<(Of <(<'T>)>)> Delegate

The BinaryPredicate delegate type encapsulates a method that takes two items of the same type, and returns a boolean value representating some relationship between them. For example, checking whether two items are equal or equivalent is one kind of binary predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public delegate bool BinaryPredicate<T>(
    T item1,
    T item2
)

Public Delegate Function BinaryPredicate(Of T) ( _
    item1 As T, _
    item2 As T _
) As Boolean
generic<typename T>
public delegate bool^ BinaryPredicate(
    T item1,
    T item2
)

Type Parameters

T

Parameters

item1
Type: T
The first item.
item2
Type: T
The second item.

Return Value

Whether item1 and item2 satisfy the relationship that the BinaryPredicate defines.

See Also

Wintellect.PowerCollections Namespace
Help File generated with GhostDoc


CollectionBase(T) Class

CollectionBase<(Of <(<'T>)>)> Class

CollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class CollectionBase<T> : ICollection<T>,
    ICollection

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class CollectionBase(Of T) _
    Implements ICollection(Of T), ICollection
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename T>
public ref class CollectionBase abstract : ICollection<T>,
    ICollection

Type Parameters

T
The item type of the collection.

Remarks

To use CollectionBase as a base class, the derived class must override the Count, GetEnumerator, Add, Clear, and Remove methods.

ICollection<T>.Contains need not be implemented by the derived class, but it should be strongly considered, because the CollectionBase implementation may not be very efficient.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase<(Of <(<'T>)>)>

See Also

CollectionBase<(Of <(<'T>)>)> Members


CollectionBase(T) Members

CollectionBase<(Of <(<'T>)>)> Members

The CollectionBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Must be overridden to allow adding items to this collection.
Public method | AsReadOnly | Provides a read-only view of this collection. The returned ICollection<T> provides a view of the collection that prevents modifications to the collection. Use the method to provide access to the collection without allowing changes. Since the returned object is just a view, changes to the collection will be reflected in the view.
Public method | Clear | Must be overridden to allow clearing this collection.
Public method | Contains | Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.
Public method | ConvertAll<(Of <<'(TOutput>)>>) | Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
Public method | CopyTo | Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
Public method | CountWhere | Counts the number of items in the collection that satisfy the condition defined by predicate.
Public method | Exists | Determines if the collection contains any item that satisfies the condition defined by predicate.
Public method | FindAll | Enumerates the items in the collection that satisfy the condition defined by predicate.
Public method | ForEach | Performs the specified action on each item in this collection.
Public method | GetEnumerator | Must be overridden to enumerate all the members of the collection.
Public method | Remove | Must be overridden to allow removing items from this collection.
Public method | RemoveAll | Removes all the items in the collection that satisfy the condition defined by predicate.
Public method | ToArray | Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
Public method | ToString | Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.
Public method | TrueForAll | Determines if all of the items in the collection satisfy the condition defined by predicate.

Properties

 | Name | Description
Public property | Count | Must be overridden to provide the number of items in the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


CollectionBase(T) Methods

CollectionBase<(Of <(<'T>)>)> Methods

The CollectionBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Must be overridden to allow adding items to this collection.
Public method | AsReadOnly | Provides a read-only view of this collection. The returned ICollection<T> provides a view of the collection that prevents modifications to the collection. Use the method to provide access to the collection without allowing changes. Since the returned object is just a view, changes to the collection will be reflected in the view.
Public method | Clear | Must be overridden to allow clearing this collection.
Public method | Contains | Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.
Public method | ConvertAll<(Of <<'(TOutput>)>>) | Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
Public method | CopyTo | Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
Public method | CountWhere | Counts the number of items in the collection that satisfy the condition defined by predicate.
Public method | Exists | Determines if the collection contains any item that satisfies the condition defined by predicate.
Public method | FindAll | Enumerates the items in the collection that satisfy the condition defined by predicate.
Public method | ForEach | Performs the specified action on each item in this collection.
Public method | GetEnumerator | Must be overridden to enumerate all the members of the collection.
Public method | Remove | Must be overridden to allow removing items from this collection.
Public method | RemoveAll | Removes all the items in the collection that satisfy the condition defined by predicate.
Public method | ToArray | Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
Public method | ToString | Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.
Public method | TrueForAll | Determines if all of the items in the collection satisfy the condition defined by predicate.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Add Method

CollectionBase<(Of <(<'T>)>)>..::..Add Method

Must be overridden to allow adding items to this collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void Add(
    T item
)
Public Overridable Sub Add ( _
    item As T _
)
public:
virtual void Add(
    T item
)

Parameters

item
Type: T
Item to be added to the collection.

Exceptions

Exception | Condition
NotImplementedException | Always throws this exception to indicated that the method must be overridden or re-implemented in the derived class.

Remarks

This method is not abstract, although derived classes should always override it. It is not abstract because some derived classes may wish to reimplement Add with a different return type (typically bool). In C#, this can be accomplished with code like the following:

C#
public class MyCollection<T>: CollectionBase<T>, ICollection<T>
{
    public new bool Add(T item) {
        /* Add the item */
    }

    void ICollection<T>.Add(T item) {
        Add(item);
    }
}

See Also

CollectionBase<(Of <(<'T>)>)> Class


AsReadOnly Method

CollectionBase<(Of <(<'T>)>)>..::..AsReadOnly Method

Provides a read-only view of this collection. The returned ICollection<T> provides a view of the collection that prevents modifications to the collection. Use the method to provide access to the collection without allowing changes. Since the returned object is just a view, changes to the collection will be reflected in the view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<T> AsReadOnly()
Public Overridable Function AsReadOnly As ICollection(Of T)
public:
virtual ICollection<T>^ AsReadOnly()

Return Value

An ICollection<T> that provides read-only access to the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Clear Method

CollectionBase<(Of <(<'T>)>)>..::..Clear Method

Must be overridden to allow clearing this collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

CollectionBase<(Of <(<'T>)>)> Class


Contains Method

CollectionBase<(Of <(<'T>)>)>..::..Contains Method

Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Contains(
    T item
)
Public Overridable Function Contains ( _
    item As T _
) As Boolean
public:
virtual bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to check for in the collection.

Return Value

True if the collection contains item, false otherwise.

Remarks

You should strongly consider overriding this method to provide a more efficient implementation, or if the default equality comparison is inappropriate.

See Also

CollectionBase<(Of <(<'T>)>)> Class


ConvertAll(TOutput) Method

CollectionBase<(Of <(<'T>)>)>..::..ConvertAll<(Of <(<'TOutput>)>)> Method

Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IEnumerable<TOutput> ConvertAll<TOutput>(
    Converter<T, TOutput> converter
)

Public Overridable Function ConvertAll(Of TOutput) ( _
    converter As Converter(Of T, TOutput) _
) As IEnumerable(Of TOutput)
public:
generic<typename TOutput>
virtual IEnumerable<TOutput>^ ConvertAll(
    Converter<T, TOutput>^ converter
)

Type Parameters

TOutput
The type each item is being converted to.

Parameters

converter
Type: Converter <(Of <(<' T, TOutput>)>)>
A delegate to the method to call, passing each item in this collection.

Return Value

An IEnumerable<TOutput^gt; that enumerates the resulting collection from applying converter to each item in this collection in order.

Exceptions

Exception | Condition
ArgumentNullException | converter is null.

See Also

CollectionBase<(Of <(<'T>)>)> Class


CopyTo Method

CollectionBase<(Of <(<'T>)>)>..::..CopyTo Method

Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    T[] array,
    int arrayIndex
)
Public Overridable Sub CopyTo ( _
    array As T(), _
    arrayIndex As Integer _
)
public:
virtual void CopyTo(
    array<T>^ array,
    int^ arrayIndex
)

Parameters

array
Type: array< T >[]()[][]
Array to copy to.
arrayIndex
Type: Int32
Starting index in array to copy to.

See Also

CollectionBase<(Of <(<'T>)>)> Class


CountWhere Method

CollectionBase<(Of <(<'T>)>)>..::..CountWhere Method

Counts the number of items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int CountWhere(
    Predicate<T> predicate
)
Public Overridable Function CountWhere ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ CountWhere(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

The number of items in the collection that satisfy predicate.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Exists Method

CollectionBase<(Of <(<'T>)>)>..::..Exists Method

Determines if the collection contains any item that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Exists(
    Predicate<T> predicate
)
Public Overridable Function Exists ( _
    predicate As Predicate(Of T) _
) As Boolean
public:
virtual bool^ Exists(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

True if the collection contains one or more items that satisfy the condition defined by predicate. False if the collection does not contain an item that satisfies predicate.

See Also

CollectionBase<(Of <(<'T>)>)> Class


FindAll Method

CollectionBase<(Of <(<'T>)>)>..::..FindAll Method

Enumerates the items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IEnumerable<T> FindAll(
    Predicate<T> predicate
)
Public Overridable Function FindAll ( _
    predicate As Predicate(Of T) _
) As IEnumerable(Of T)
public:
virtual IEnumerable<T>^ FindAll(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

An IEnumerable<T> that enumerates the items that satisfy the condition.

See Also

CollectionBase<(Of <(<'T>)>)> Class


ForEach Method

CollectionBase<(Of <(<'T>)>)>..::..ForEach Method

Performs the specified action on each item in this collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void ForEach(
    Action<T> action
)
Public Overridable Sub ForEach ( _
    action As Action(Of T) _
)
public:
virtual void ForEach(
    Action<T>^ action
)

Parameters

action
Type: Action <(Of <(<' T >)>)>
An Action delegate which is invoked for each item in this collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


GetEnumerator Method

CollectionBase<(Of <(<'T>)>)>..::..GetEnumerator Method

Must be overridden to enumerate all the members of the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

A generic IEnumerator<T> that can be used to enumerate all the items in the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Remove Method

CollectionBase<(Of <(<'T>)>)>..::..Remove Method

Must be overridden to allow removing items from this collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T

Return Value

True if item existed in the collection and was removed. False if item did not exist in the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


RemoveAll Method

CollectionBase<(Of <(<'T>)>)>..::..RemoveAll Method

Removes all the items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<T> RemoveAll(
    Predicate<T> predicate
)
Public Overridable Function RemoveAll ( _
    predicate As Predicate(Of T) _
) As ICollection(Of T)
public:
virtual ICollection<T>^ RemoveAll(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

Returns a collection of the items that were removed, in sorted order.

See Also

CollectionBase<(Of <(<'T>)>)> Class


ToArray Method

CollectionBase<(Of <(<'T>)>)>..::..ToArray Method

Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T[] ToArray()
Public Overridable Function ToArray As T()
public:
virtual array<T>^ ToArray()

Return Value

An array containing all the elements in the collection, in order.

See Also

CollectionBase<(Of <(<'T>)>)> Class


ToString Method

CollectionBase<(Of <(<'T>)>)>..::..ToString Method

Shows the string representation of the collection. The string representation contains a list of the items in the collection. Contained collections (except string) are expanded recursively.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


TrueForAll Method

CollectionBase<(Of <(<'T>)>)>..::..TrueForAll Method

Determines if all of the items in the collection satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TrueForAll(
    Predicate<T> predicate
)
Public Overridable Function TrueForAll ( _
    predicate As Predicate(Of T) _
) As Boolean
public:
virtual bool^ TrueForAll(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

True if all of the items in the collection satisfy the condition defined by predicate, or if the collection is empty. False if one or more items in the collection do not satisfy predicate.

See Also

CollectionBase<(Of <(<'T>)>)> Class


CollectionBase(T) Properties

CollectionBase<(Of <(<'T>)>)> Properties

The CollectionBase<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Must be overridden to provide the number of items in the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Count Property

CollectionBase<(Of <(<'T>)>)>..::..Count Property

Must be overridden to provide the number of items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the collection.

See Also

CollectionBase<(Of <(<'T>)>)> Class


Deque(T) Class

Deque<(Of <(<'T>)>)> Class

The Deque class implements a type of list known as a Double Ended Queue. A Deque is quite similar to a List, in that items have indices (starting at 0), and the item at any index can be efficiently retrieved. The difference between a List and a Deque lies in the efficiency of inserting elements at the beginning. In a List, items can be efficiently added to the end, but inserting an item at the beginning of the List is slow, taking time proportional to the size of the List. In a Deque, items can be added to the beginning or end equally efficiently, regardless of the number of items in the Deque. As a trade-off for this increased flexibility, Deque is somewhat slower than List (but still constant time) when being indexed to get or retrieve elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class Deque<T> : ListBase<T>

<SerializableAttribute> _
Public Class Deque(Of T) _
    Inherits ListBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class Deque : public ListBase<T>

Type Parameters

T
The type of items stored in the Deque.

Remarks

The Deque class can also be used as a more flexible alternative to the Queue and Stack classes. Deque is as efficient as Queue and Stack for adding or removing items, but is more flexible: it allows access to all items in the queue, and allows adding or removing from either end.

Deque is implemented as a ring buffer, which is grown as necessary. The size of the buffer is doubled whenever the existing capacity is too small to hold all the elements.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' T >)>)>
Wintellect.PowerCollections..::..ListBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..Deque<(Of <(<'T>)>)>

See Also

Deque<(Of <(<'T>)>)> Members


Deque(T) Members

Deque<(Of <(<'T>)>)> Members

The Deque<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | Deque<(Of <(<'T>)>)>()()()() | Create a new Deque that is initially empty.
Public method | Deque<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Create a new Deque initialized with the items from the passed collection, in order.

Methods

 | Name | Description
Public method | Add | Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to AddToBack(item).
Public method | AddManyToBack | Adds a collection of items to the back of the Deque. The indices of all existing items in the Deque are unchanged. The last item in the added collection becomes the last item in the Deque.
Public method | AddManyToFront | Adds a collection of items to the front of the Deque. The indices of all existing items in the Deque are increased by the number of items inserted. The first item in the added collection becomes the first item in the Deque.
Public method | AddToBack | Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to Insert(Count, item) but is a little more efficient.
Public method | AddToFront | Adds an item to the front of the Deque. The indices of all existing items in the Deque are increased by 1. This method is equivalent to Insert(0, item) but is a little more efficient.
Public method | Clear | Removes all items from the Deque.
Public method | Clone | Creates a new Deque that is a copy of this one.
Public method | CloneContents | Makes a deep clone of this Deque. A new Deque is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | CopyTo | Copies all the items in the Deque into an array.
Public method | GetAtBack | Retreives the item currently at the back of the Deque. The Deque is unchanged. This method is equivalent to deque[deque.Count - 1] (except that a different exception is thrown).
Public method | GetAtFront | Retreives the item currently at the front of the Deque. The Deque is unchanged. This method is equivalent to deque[0] (except that a different exception is thrown).
Public method | GetEnumerator | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. If the items are added to or removed from the Deque during enumeration, the enumeration ends with an InvalidOperationException.
Public method | Insert | Inserts a new item at the given index in the Deque. All items at indexes equal to or greater than index move up one index in the Deque.
Public method | InsertRange | Inserts a collection of items at the given index in the Deque. All items at indexes equal to or greater than index increase their indices in the Deque by the number of items inserted.
Public method | RemoveAt | Removes the item at the given index in the Deque. All items at indexes greater than index move down one index in the Deque.
Public method | RemoveFromBack | Removes an item from the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to RemoveAt(Count-1) but is a little more efficient.
Public method | RemoveFromFront | Removes an item from the front of the Deque. The indices of all existing items in the Deque are decreased by 1. This method is equivalent to RemoveAt(0) but is a little more efficient.
Public method | RemoveRange | Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.
Public method | TrimToSize | Trims the amount of memory used by the Deque by changing the Capacity to be equal to Count. If no more items will be added to the Deque, calling TrimToSize will reduce the amount of memory used by the Deque.

Properties

 | Name | Description
Public property | Capacity | Gets or sets the capacity of the Deque. The Capacity is the number of items that this Deque can hold without expanding its internal buffer. Since Deque will automatically expand its buffer when necessary, in almost all cases it is unnecessary to worry about the capacity. However, if it is known that a Deque will contain exactly 1000 items eventually, it can slightly improve efficiency to set the capacity to 1000 up front, so that the Deque does not have to expand automatically.
Public property | Count | Gets the number of items currently stored in the Deque. The last item in the Deque has index Count-1.
Public property | Item | Gets or sets an item at a particular index in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


Deque(T) Constructor

Deque<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | Deque<(Of <(<'T>)>)>()()()() | Create a new Deque that is initially empty.
Public method | Deque<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Create a new Deque initialized with the items from the passed collection, in order.

See Also

Deque<(Of <(<'T>)>)> Class
Deque<(Of <(<'T>)>)> Members


Deque(T) Constructor

Deque<(Of <(<'T>)>)> Constructor

Create a new Deque that is initially empty.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Deque()
Public Sub New
public:
Deque()

See Also

Deque<(Of <(<'T>)>)> Class
Deque<(Of <(<'T>)>)> Overload


Deque(T) Constructor (IEnumerable(T))

Deque<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Create a new Deque initialized with the items from the passed collection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Deque(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
Deque(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to initialize the Deque with.

See Also

Deque<(Of <(<'T>)>)> Class
Deque<(Of <(<'T>)>)> Overload


Deque(T) Methods

Deque<(Of <(<'T>)>)> Methods

The Deque<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to AddToBack(item).
Public method | AddManyToBack | Adds a collection of items to the back of the Deque. The indices of all existing items in the Deque are unchanged. The last item in the added collection becomes the last item in the Deque.
Public method | AddManyToFront | Adds a collection of items to the front of the Deque. The indices of all existing items in the Deque are increased by the number of items inserted. The first item in the added collection becomes the first item in the Deque.
Public method | AddToBack | Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to Insert(Count, item) but is a little more efficient.
Public method | AddToFront | Adds an item to the front of the Deque. The indices of all existing items in the Deque are increased by 1. This method is equivalent to Insert(0, item) but is a little more efficient.
Public method | Clear | Removes all items from the Deque.
Public method | Clone | Creates a new Deque that is a copy of this one.
Public method | CloneContents | Makes a deep clone of this Deque. A new Deque is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | CopyTo | Copies all the items in the Deque into an array.
Public method | GetAtBack | Retreives the item currently at the back of the Deque. The Deque is unchanged. This method is equivalent to deque[deque.Count - 1] (except that a different exception is thrown).
Public method | GetAtFront | Retreives the item currently at the front of the Deque. The Deque is unchanged. This method is equivalent to deque[0] (except that a different exception is thrown).
Public method | GetEnumerator | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. If the items are added to or removed from the Deque during enumeration, the enumeration ends with an InvalidOperationException.
Public method | Insert | Inserts a new item at the given index in the Deque. All items at indexes equal to or greater than index move up one index in the Deque.
Public method | InsertRange | Inserts a collection of items at the given index in the Deque. All items at indexes equal to or greater than index increase their indices in the Deque by the number of items inserted.
Public method | RemoveAt | Removes the item at the given index in the Deque. All items at indexes greater than index move down one index in the Deque.
Public method | RemoveFromBack | Removes an item from the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to RemoveAt(Count-1) but is a little more efficient.
Public method | RemoveFromFront | Removes an item from the front of the Deque. The indices of all existing items in the Deque are decreased by 1. This method is equivalent to RemoveAt(0) but is a little more efficient.
Public method | RemoveRange | Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.
Public method | TrimToSize | Trims the amount of memory used by the Deque by changing the Capacity to be equal to Count. If no more items will be added to the Deque, calling TrimToSize will reduce the amount of memory used by the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


Add Method

Deque<(Of <(<'T>)>)>..::..Add Method

Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to AddToBack(item).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add.

Remarks

Adding an item to the back of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


AddManyToBack Method

Deque<(Of <(<'T>)>)>..::..AddManyToBack Method

Adds a collection of items to the back of the Deque. The indices of all existing items in the Deque are unchanged. The last item in the added collection becomes the last item in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddManyToBack(
    IEnumerable<T> collection
)
Public Sub AddManyToBack ( _
    collection As IEnumerable(Of T) _
)
public:
void AddManyToBack(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of item to add.

Remarks

This method takes time O(M), where M is the number of items in the collection.

See Also

Deque<(Of <(<'T>)>)> Class


AddManyToFront Method

Deque<(Of <(<'T>)>)>..::..AddManyToFront Method

Adds a collection of items to the front of the Deque. The indices of all existing items in the Deque are increased by the number of items inserted. The first item in the added collection becomes the first item in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddManyToFront(
    IEnumerable<T> collection
)
Public Sub AddManyToFront ( _
    collection As IEnumerable(Of T) _
)
public:
void AddManyToFront(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of items to add.

Remarks

This method takes time O(M), where M is the number of items in the collection.

See Also

Deque<(Of <(<'T>)>)> Class


AddToBack Method

Deque<(Of <(<'T>)>)>..::..AddToBack Method

Adds an item to the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to Insert(Count, item) but is a little more efficient.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddToBack(
    T item
)
Public Sub AddToBack ( _
    item As T _
)
public:
void AddToBack(
    T item
)

Parameters

item
Type: T
The item to add.

Remarks

Adding an item to the back of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


AddToFront Method

Deque<(Of <(<'T>)>)>..::..AddToFront Method

Adds an item to the front of the Deque. The indices of all existing items in the Deque are increased by 1. This method is equivalent to Insert(0, item) but is a little more efficient.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddToFront(
    T item
)
Public Sub AddToFront ( _
    item As T _
)
public:
void AddToFront(
    T item
)

Parameters

item
Type: T
The item to add.

Remarks

Adding an item to the front of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


Clear Method

Deque<(Of <(<'T>)>)>..::..Clear Method

Removes all items from the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the Deque takes a small constant amount of time, regardless of how many items are currently in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


Clone Method

Deque<(Of <(<'T>)>)>..::..Clone Method

Creates a new Deque that is a copy of this one.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Deque<T> Clone()
Public Function Clone As Deque(Of T)
public:
Deque<T>^ Clone()

Return Value

A copy of the current deque.

Remarks

Copying a Deque takes O(N) time, where N is the number of items in this Deque..

See Also

Deque<(Of <(<'T>)>)> Class


CloneContents Method

Deque<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this Deque. A new Deque is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Deque<T> CloneContents()
Public Function CloneContents As Deque(Of T)
public:
Deque<T>^ CloneContents()

Return Value

The cloned Deque.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the Deque takes time O(N), where N is the number of items in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


CopyTo Method

Deque<(Of <(<'T>)>)>..::..CopyTo Method

Copies all the items in the Deque into an array.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void CopyTo(
    T[] array,
    int arrayIndex
)
Public Sub CopyTo ( _
    array As T(), _
    arrayIndex As Integer _
)
public:
void CopyTo(
    array<T>^ array,
    int^ arrayIndex
)

Parameters

array
Type: array< T >[]()[][]
Array to copy to.
arrayIndex
Type: Int32
Starting index in array to copy to.

See Also

Deque<(Of <(<'T>)>)> Class


GetAtBack Method

Deque<(Of <(<'T>)>)>..::..GetAtBack Method

Retreives the item currently at the back of the Deque. The Deque is unchanged. This method is equivalent to deque[deque.Count - 1] (except that a different exception is thrown).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetAtBack()
Public Function GetAtBack As T
public:
T GetAtBack()

Return Value

The item at the back of the Deque.

Exceptions

Exception | Condition
InvalidOperationException | The Deque is empty.

Remarks

Retreiving the item at the back of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


GetAtFront Method

Deque<(Of <(<'T>)>)>..::..GetAtFront Method

Retreives the item currently at the front of the Deque. The Deque is unchanged. This method is equivalent to deque[0] (except that a different exception is thrown).

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetAtFront()
Public Function GetAtFront As T
public:
T GetAtFront()

Return Value

The item at the front of the Deque.

Exceptions

Exception | Condition
InvalidOperationException | The Deque is empty.

Remarks

Retreiving the item at the front of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


GetEnumerator Method

Deque<(Of <(<'T>)>)>..::..GetEnumerator Method

Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on. If the items are added to or removed from the Deque during enumeration, the enumeration ends with an InvalidOperationException.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> that enumerates all the items in the list.

Exceptions

Exception | Condition
InvalidOperationException | The Deque has an item added or deleted during the enumeration.

See Also

Deque<(Of <(<'T>)>)> Class


Insert Method

Deque<(Of <(<'T>)>)>..::..Insert Method

Inserts a new item at the given index in the Deque. All items at indexes equal to or greater than index move up one index in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Insert(
    int index,
    T item
)
Public Sub Insert ( _
    index As Integer, _
    item As T _
)
public:
void Insert(
    int^ index,
    T item
)

Parameters

index
Type: Int32
The index in the Deque to insert the item at. After the insertion, the inserted item is located at this index. The front item in the Deque has index 0.
item
Type: T
The item to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.

Remarks

The amount of time to insert an item in the Deque is proportional to the distance of index from the closest end of the Deque: O(Min(index, Count - index)). Thus, inserting an item at the front or end of the Deque is always fast; the middle of of the Deque is the slowest place to insert.

See Also

Deque<(Of <(<'T>)>)> Class


InsertRange Method

Deque<(Of <(<'T>)>)>..::..InsertRange Method

Inserts a collection of items at the given index in the Deque. All items at indexes equal to or greater than index increase their indices in the Deque by the number of items inserted.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void InsertRange(
    int index,
    IEnumerable<T> collection
)
Public Sub InsertRange ( _
    index As Integer, _
    collection As IEnumerable(Of T) _
)
public:
void InsertRange(
    int^ index,
    IEnumerable<T>^ collection
)

Parameters

index
Type: Int32
The index in the Deque to insert the collection at. After the insertion, the first item of the inserted collection is located at this index. The front item in the Deque has index 0.
collection
Type: IEnumerable <(Of <(<' T >)>)>
The collection of items to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.

Remarks

The amount of time to insert a collection in the Deque is proportional to the distance of index from the closest end of the Deque, plus the number of items inserted (M): O(M + Min(index, Count - index)).

See Also

Deque<(Of <(<'T>)>)> Class


RemoveAt Method

Deque<(Of <(<'T>)>)>..::..RemoveAt Method

Removes the item at the given index in the Deque. All items at indexes greater than index move down one index in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void RemoveAt(
    int index
)
Public Sub RemoveAt ( _
    index As Integer _
)
public:
void RemoveAt(
    int^ index
)

Parameters

index
Type: Int32
The index in the list to remove the item at. The first item in the list has index 0.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The amount of time to delete an item in the Deque is proportional to the distance of index from the closest end of the Deque: O(Min(index, Count - 1 - index)). Thus, deleting an item at the front or end of the Deque is always fast; the middle of of the Deque is the slowest place to delete.

See Also

Deque<(Of <(<'T>)>)> Class


RemoveFromBack Method

Deque<(Of <(<'T>)>)>..::..RemoveFromBack Method

Removes an item from the back of the Deque. The indices of all existing items in the Deque are unchanged. This method is equivalent to RemoveAt(Count-1) but is a little more efficient.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveFromBack()
Public Function RemoveFromBack As T
public:
T RemoveFromBack()

Exceptions

Exception | Condition
InvalidOperationException | The Deque is empty.

Remarks

Removing an item from the back of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


RemoveFromFront Method

Deque<(Of <(<'T>)>)>..::..RemoveFromFront Method

Removes an item from the front of the Deque. The indices of all existing items in the Deque are decreased by 1. This method is equivalent to RemoveAt(0) but is a little more efficient.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveFromFront()
Public Function RemoveFromFront As T
public:
T RemoveFromFront()

Return Value

The item that was removed.

Exceptions

Exception | Condition
InvalidOperationException | The Deque is empty.

Remarks

Removing an item from the front of the Deque takes a small constant amount of time, regardless of how many items are in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


RemoveRange Method

Deque<(Of <(<'T>)>)>..::..RemoveRange Method

Removes a range of items at the given index in the Deque. All items at indexes greater than index move down count indices in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void RemoveRange(
    int index,
    int count
)
Public Sub RemoveRange ( _
    index As Integer, _
    count As Integer _
)
public:
void RemoveRange(
    int^ index,
    int^ count
)

Parameters

index
Type: Int32
The index in the list to remove the range at. The first item in the list has index 0.
count
Type: Int32
The number of items to remove.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count, or count is less than zero or too large.

Remarks

The amount of time to delete count items in the Deque is proportional to the distance to the closest end of the Deque: O(Min(index, Count - index - count)).

See Also

Deque<(Of <(<'T>)>)> Class


TrimToSize Method

Deque<(Of <(<'T>)>)>..::..TrimToSize Method

Trims the amount of memory used by the Deque by changing the Capacity to be equal to Count. If no more items will be added to the Deque, calling TrimToSize will reduce the amount of memory used by the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void TrimToSize()
Public Sub TrimToSize
public:
void TrimToSize()

See Also

Deque<(Of <(<'T>)>)> Class


Deque(T) Properties

Deque<(Of <(<'T>)>)> Properties

The Deque<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Capacity | Gets or sets the capacity of the Deque. The Capacity is the number of items that this Deque can hold without expanding its internal buffer. Since Deque will automatically expand its buffer when necessary, in almost all cases it is unnecessary to worry about the capacity. However, if it is known that a Deque will contain exactly 1000 items eventually, it can slightly improve efficiency to set the capacity to 1000 up front, so that the Deque does not have to expand automatically.
Public property | Count | Gets the number of items currently stored in the Deque. The last item in the Deque has index Count-1.
Public property | Item | Gets or sets an item at a particular index in the Deque.

See Also

Deque<(Of <(<'T>)>)> Class


Capacity Property

Deque<(Of <(<'T>)>)>..::..Capacity Property

Gets or sets the capacity of the Deque. The Capacity is the number of items that this Deque can hold without expanding its internal buffer. Since Deque will automatically expand its buffer when necessary, in almost all cases it is unnecessary to worry about the capacity. However, if it is known that a Deque will contain exactly 1000 items eventually, it can slightly improve efficiency to set the capacity to 1000 up front, so that the Deque does not have to expand automatically.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Capacity { get; set; }
Public Property Capacity As Integer
    Get
    Set
public:
property int^ Capacity {
    int^ get ();
    void set (int^ value);
}

Field Value

The number of items that this Deque can hold without expanding its internal buffer.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The capacity is being set to less than Count, or to too large a value.

See Also

Deque<(Of <(<'T>)>)> Class


Count Property

Deque<(Of <(<'T>)>)>..::..Count Property

Gets the number of items currently stored in the Deque. The last item in the Deque has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items stored in this Deque.

Remarks

Getting the count of items in the Deque takes a small constant amount of time.

See Also

Deque<(Of <(<'T>)>)> Class


Item Property

Deque<(Of <(<'T>)>)>..::..Item Property

Gets or sets an item at a particular index in the Deque.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; set; }
Public Default Property Item ( _
    index As Integer _
) As T
    Get
    Set
public:
property T default[int^ index] {
    T get (int^ index);
    void set (int^ index, T value);
}

Parameters

index
Type: Int32
The index of the item to retrieve or change. The front item has index 0, and the back item has index Count-1.

Return Value

The value at the indicated index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | The index is less than zero or greater than or equal to Count.

Remarks

Getting or setting the item at a particular index takes a small constant amount of time, no matter what index is used.

See Also

Deque<(Of <(<'T>)>)> Class


DictionaryBase(TKey, TValue) Class

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class

DictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class DictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, TValue>>

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class DictionaryBase(Of TKey, TValue) _
    Inherits CollectionBase(Of KeyValuePair(Of TKey, TValue))
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename TKey, typename TValue>
public ref class DictionaryBase abstract : public CollectionBase<KeyValuePair<TKey, TValue>^>

Type Parameters

TKey
The key type of the dictionary.
TValue
The value type of the dictionary.

Remarks

To use DictionaryBase as a base class, the derived class must override Count, GetEnumerator, TryGetValue, Clear, Remove, and the indexer set accessor.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<'TKey, TValue>)>)>>)>)>
Wintellect.PowerCollections..::..DictionaryBase<(Of <(<'TKey, TValue>)>)>

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Members


DictionaryBase(TKey, TValue) Members

DictionaryBase<(Of <(<'TKey, TValue>)>)> Members

The DictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary.
Public method | Add(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item.
Public method | AsReadOnly | Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides a view of the dictionary that prevents modifications to the dictionary. Use the method to provide access to the dictionary without allowing changes. Since the returned object is just a view, changes to the dictionary will be reflected in the view.
Public method | Clear | Clears the dictionary. This method must be overridden in the derived class.
Public method | Contains | Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Determines if a dictionary contains a given KeyValuePair, and if so, removes it. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value. If so, the key-value pair is removed.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden by the derived class.

Properties

 | Name | Description
Public property | Item | The indexer of the dictionary. This is used to store keys and values and retrieve values from the dictionary. The setter accessor must be overridden in the derived class.
Public property | Keys | Returns a collection of the keys in this dictionary.
Public property | Values | Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


DictionaryBase(TKey, TValue) Methods

DictionaryBase<(Of <(<'TKey, TValue>)>)> Methods

The DictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary.
Public method | Add(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item.
Public method | AsReadOnly | Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides a view of the dictionary that prevents modifications to the dictionary. Use the method to provide access to the dictionary without allowing changes. Since the returned object is just a view, changes to the dictionary will be reflected in the view.
Public method | Clear | Clears the dictionary. This method must be overridden in the derived class.
Public method | Contains | Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Determines if a dictionary contains a given KeyValuePair, and if so, removes it. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value. If so, the key-value pair is removed.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden by the derived class.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Add Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method

Overload List

 | Name | Description
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary.
Public method | Add(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
DictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Add Method (TKey, TValue)

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method (TKey, TValue)

Adds a new key-value pair to the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void Add(
    TKey key,
    TValue value
)
Public Overridable Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
virtual void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
Key to add.
value
Type: TValue
Value to associated with the key.

Exceptions

Exception | Condition
ArgumentException | key is already present in the dictionary

Remarks

The default implementation of this method checks to see if the key already exists using ContainsKey, then calls the indexer setter if the key doesn't already exist.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Add Overload


Add Method (KeyValuePair(TKey, TValue))

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method (KeyValuePair<(Of <(<'TKey, TValue>)>)>)

Adds a key-value pair to the collection. This implementation calls the Add method with the Key and Value from the item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    KeyValuePair<TKey, TValue> item
)
Public Sub Add ( _
    item As KeyValuePair(Of TKey, TValue) _
)
public:
void Add(
    KeyValuePair<TKey, TValue>^ item
)

Parameters

item
Type: KeyValuePair <(Of <(<' TKey, TValue >)>)>
A KeyValuePair contains the Key and Value to add.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Add Overload


AsReadOnly Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..AsReadOnly Method

Provides a read-only view of this dictionary. The returned IDictionary<TKey,TValue> provides a view of the dictionary that prevents modifications to the dictionary. Use the method to provide access to the dictionary without allowing changes. Since the returned object is just a view, changes to the dictionary will be reflected in the view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IDictionary<TKey, TValue> AsReadOnly()
Public Overridable Function AsReadOnly As IDictionary(Of TKey, TValue)
public:
virtual IDictionary<TKey, TValue>^ AsReadOnly()

Return Value

An IIDictionary<TKey,TValue> that provides read-only access to the dictionary.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Clear Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Clear Method

Clears the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Contains Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    KeyValuePair<TKey, TValue> item
)
Public Function Contains ( _
    item As KeyValuePair(Of TKey, TValue) _
) As Boolean
public:
bool^ Contains(
    KeyValuePair<TKey, TValue>^ item
)

Parameters

item
Type: KeyValuePair <(Of <(<' TKey, TValue >)>)>
A KeyValuePair containing the Key and Value to check for.

Return Value

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ContainsKey Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Determines whether a given key is found in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool ContainsKey(
    TKey key
)
Public Overridable Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
virtual bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to look for in the dictionary.

Return Value

True if the key is present in the dictionary.

Remarks

The default implementation simply calls TryGetValue and returns what it returns.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Remove Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Overload List

 | Name | Description
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, TValue>)>>)) | Determines if a dictionary contains a given KeyValuePair, and if so, removes it. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value. If so, the key-value pair is removed.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
DictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Remove Method (TKey)

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey)

Removes a key from the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
Key to remove from the dictionary.

Return Value

True if the key was found, false otherwise.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Remove Method (KeyValuePair(TKey, TValue))

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method (KeyValuePair<(Of <(<'TKey, TValue>)>)>)

Determines if a dictionary contains a given KeyValuePair, and if so, removes it. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value. If so, the key-value pair is removed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    KeyValuePair<TKey, TValue> item
)
Public Function Remove ( _
    item As KeyValuePair(Of TKey, TValue) _
) As Boolean
public:
bool^ Remove(
    KeyValuePair<TKey, TValue>^ item
)

Parameters

item
Type: KeyValuePair <(Of <(<' TKey, TValue >)>)>
A KeyValuePair containing the Key and Value to check for.

Return Value

True if the item was found and removed. False otherwise.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


ToString Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ToString Method

Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the dictionary.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


TryGetValue Method

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..TryGetValue Method

Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden by the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetValue(
    TKey key,
    out TValue value
)
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
public:
bool^ TryGetValue(
    TKey key,
    [OutAttribute] TValue% value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue %
Returns the value assocciated with key, if true was returned.

Return Value

True if the dictionary contains key. False if the dictionary does not contain key.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


DictionaryBase(TKey, TValue) Properties

DictionaryBase<(Of <(<'TKey, TValue>)>)> Properties

The DictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Item | The indexer of the dictionary. This is used to store keys and values and retrieve values from the dictionary. The setter accessor must be overridden in the derived class.
Public property | Keys | Returns a collection of the keys in this dictionary.
Public property | Values | Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Item Property

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Item Property

The indexer of the dictionary. This is used to store keys and values and retrieve values from the dictionary. The setter accessor must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual TValue this[
    TKey key
] { get; set; }
Public Overridable Default Property Item ( _
    key As TKey _
) As TValue
    Get
    Set
public:
virtual property TValue default[TKey key] {
    TValue get (TKey key);
    void set (TKey key, TValue value);
}

Parameters

key
Type: TKey
Key to find in the dictionary.

Return Value

The value associated with the key.

Exceptions

Exception | Condition
KeyNotFoundException | Thrown from the get accessor if the key was not found in the dictionary.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Keys Property

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Keys Property

Returns a collection of the keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TKey> Keys { get; }
Public Overridable ReadOnly Property Keys As ICollection(Of TKey)
    Get
public:
virtual property ICollection<TKey>^ Keys {
    ICollection<TKey>^ get ();
}

Field Value

A read-only collection of the keys in this dictionary.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Values Property

DictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Values Property

Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> Values { get; }
Public Overridable ReadOnly Property Values As ICollection(Of TValue)
    Get
public:
virtual property ICollection<TValue>^ Values {
    ICollection<TValue>^ get ();
}

Field Value

A read-only collection of the values in this dictionary.

See Also

DictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ListBase(T) Class

ListBase<(Of <(<'T>)>)> Class

ListBase is an abstract class that can be used as a base class for a read-write collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the following methods: Count, Clear, Insert, RemoveAt, and the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public abstract class ListBase<T> : CollectionBase<T>

<SerializableAttribute> _
Public MustInherit Class ListBase(Of T) _
    Inherits CollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class ListBase abstract : public CollectionBase<T>

Type Parameters

T

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..ListBase<(Of <(<'T>)>)>

See Also

ListBase<(Of <(<'T>)>)> Members


ListBase(T) Members

ListBase<(Of <(<'T>)>)> Members

The ListBase<(Of <(<'T>)>)> type exposes the following members.

Methods

Name Description
Public method Add
Adds an item to the end of the list. This method is equivalent to calling:
C#
Insert(Count, item)
Public method AsReadOnly
Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view.
Public method Clear
This method must be overridden by the derived class to empty the list of all items.
Public method Contains
Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.
Public method CopyTo(array<T>[]()[][])
Copies all the items in the list, in order, to array, starting at index 0.
Public method CopyTo(array<T>[]()[][], Int32)
Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method CopyTo(Int32, array<T>[]()[][], Int32, Int32)
Copies a range of elements from the list to array, starting at arrayIndex.
Public method Find
Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method FindIndex(Predicate<(Of <<'(T>)>>))
Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindIndex(Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLast
Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method FindLastIndex(Predicate<(Of <<'(T>)>>))
Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLastIndex(Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method GetEnumerator
Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.
Public method IndexOf(T)
Finds the index of the first item in the list that is equal to item.
Public method IndexOf(T, Int32)
Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method IndexOf(T, Int32, Int32)
Finds the index of the first item, in the range of count items starting from index, that is equal to item.
Public method Insert
This method must be overridden by the derived class to insert a new item at the given index.
Public method LastIndexOf(T)
Finds the index of the last item in the list that is equal to item.
Public method LastIndexOf(T, Int32)
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method LastIndexOf(T, Int32, Int32)
Finds the index of the last item, in the range of count items ending at index, that is equal to item.
Public method Range
Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Public method Remove
Searches the list for the first item that compares equal to item. If one is found, it is removed. Otherwise, the list is unchanged.
Public method RemoveAt
This method must be overridden by the derived class to remove the item at the given index.
Public method TryFind
Finds the first item in the list that satisfies the condition defined by predicate.
Public method TryFindLast
Finds the last item in the list that satisfies the condition defined by predicate.

Properties

 | Name | Description
Public property | Count | The property must be overridden by the derived class to return the number of items in the list.
Public property | Item | The indexer must be overridden by the derived class to get and set values of the list at a particular index.

See Also

ListBase<(Of <(<'T>)>)> Class


ListBase(T) Methods

ListBase<(Of <(<'T>)>)> Methods

The ListBase<(Of <(<'T>)>)> type exposes the following members.

Methods

Name Description
Public method Add
Adds an item to the end of the list. This method is equivalent to calling:
C#
Insert(Count, item)
Public method AsReadOnly
Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view.
Public method Clear
This method must be overridden by the derived class to empty the list of all items.
Public method Contains
Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.
Public method CopyTo(array<T>[]()[][])
Copies all the items in the list, in order, to array, starting at index 0.
Public method CopyTo(array<T>[]()[][], Int32)
Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method CopyTo(Int32, array<T>[]()[][], Int32, Int32)
Copies a range of elements from the list to array, starting at arrayIndex.
Public method Find
Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method FindIndex(Predicate<(Of <<'(T>)>>))
Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindIndex(Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLast
Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method FindLastIndex(Predicate<(Of <<'(T>)>>))
Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLastIndex(Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>))
Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method GetEnumerator
Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.
Public method IndexOf(T)
Finds the index of the first item in the list that is equal to item.
Public method IndexOf(T, Int32)
Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method IndexOf(T, Int32, Int32)
Finds the index of the first item, in the range of count items starting from index, that is equal to item.
Public method Insert
This method must be overridden by the derived class to insert a new item at the given index.
Public method LastIndexOf(T)
Finds the index of the last item in the list that is equal to item.
Public method LastIndexOf(T, Int32)
Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method LastIndexOf(T, Int32, Int32)
Finds the index of the last item, in the range of count items ending at index, that is equal to item.
Public method Range
Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.
Public method Remove
Searches the list for the first item that compares equal to item. If one is found, it is removed. Otherwise, the list is unchanged.
Public method RemoveAt
This method must be overridden by the derived class to remove the item at the given index.
Public method TryFind
Finds the first item in the list that satisfies the condition defined by predicate.
Public method TryFindLast
Finds the last item in the list that satisfies the condition defined by predicate.

See Also

ListBase<(Of <(<'T>)>)> Class


Add Method

ListBase<(Of <(<'T>)>)>..::..Add Method

Adds an item to the end of the list. This method is equivalent to calling:
C#
Insert(Count, item)

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add to the list.

See Also

ListBase<(Of <(<'T>)>)> Class


AsReadOnly Method

ListBase<(Of <(<'T>)>)>..::..AsReadOnly Method

Provides a read-only view of this list. The returned IList<T> provides a view of the list that prevents modifications to the list. Use the method to provide access to the list without allowing changes. Since the returned object is just a view, changes to the list will be reflected in the view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IList<T> AsReadOnly()
Public Overridable Function AsReadOnly As IList(Of T)
public:
virtual IList<T>^ AsReadOnly()

Return Value

An IList<T> that provides read-only access to the list.

See Also

ListBase<(Of <(<'T>)>)> Class


Clear Method

ListBase<(Of <(<'T>)>)>..::..Clear Method

This method must be overridden by the derived class to empty the list of all items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

ListBase<(Of <(<'T>)>)> Class


Contains Method

ListBase<(Of <(<'T>)>)>..::..Contains Method

Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the list contains an item that compares equal to item.

Remarks

Equality in the list is determined by the default sense of equality for T. If T implements IComparable<T>, the Equals method of that interface is used to determine equality. Otherwise, Object.Equals is used to determine equality.

See Also

ListBase<(Of <(<'T>)>)> Class


CopyTo Method

ListBase<(Of <(<'T>)>)>..::..CopyTo Method

Overload List

 | Name | Description
Public method | CopyTo(array<T>[]()[][]) | Copies all the items in the list, in order, to array, starting at index 0.
Public method | CopyTo(array<T>[]()[][], Int32) | Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method | CopyTo(Int32, array<T>[]()[][], Int32, Int32) | Copies a range of elements from the list to array, starting at arrayIndex.

See Also

ListBase<(Of <(<'T>)>)> Class
ListBase<(Of <(<'T>)>)> Members


CopyTo Method (T[])

ListBase<(Of <(<'T>)>)>..::..CopyTo Method (array<T>[]()[][])

Copies all the items in the list, in order, to array, starting at index 0.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    T[] array
)
Public Overridable Sub CopyTo ( _
    array As T() _
)
public:
virtual void CopyTo(
    array<T>^ array
)

Parameters

array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count.

See Also

ListBase<(Of <(<'T>)>)> Class
CopyTo Overload


CopyTo Method (T[], Int32)

ListBase<(Of <(<'T>)>)>..::..CopyTo Method (array<T>[]()[][], Int32)

Copies all the items in the list, in order, to array, starting at arrayIndex.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void CopyTo(
    T[] array,
    int arrayIndex
)
Public Sub CopyTo ( _
    array As T(), _
    arrayIndex As Integer _
)
public:
void CopyTo(
    array<T>^ array,
    int^ arrayIndex
)

Parameters

array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex.
arrayIndex
Type: Int32
The starting index in array to copy to.

See Also

ListBase<(Of <(<'T>)>)> Class
CopyTo Overload


CopyTo Method (Int32, T[], Int32, Int32)

ListBase<(Of <(<'T>)>)>..::..CopyTo Method (Int32, array<T>[]()[][], Int32, Int32)

Copies a range of elements from the list to array, starting at arrayIndex.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    int index,
    T[] array,
    int arrayIndex,
    int count
)
Public Overridable Sub CopyTo ( _
    index As Integer, _
    array As T(), _
    arrayIndex As Integer, _
    count As Integer _
)
public:
virtual void CopyTo(
    int^ index,
    array<T>^ array,
    int^ arrayIndex,
    int^ count
)

Parameters

index
Type: Int32
The starting index in the source list of the range to copy.
array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex.
arrayIndex
Type: Int32
The starting index in array to copy to.
count
Type: Int32
The number of items to copy.

See Also

ListBase<(Of <(<'T>)>)> Class
CopyTo Overload


Find Method

ListBase<(Of <(<'T>)>)>..::..Find Method

Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T Find(
    Predicate<T> predicate
)
Public Overridable Function Find ( _
    predicate As Predicate(Of T) _
) As T
public:
virtual T Find(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The first item that satisfies the condition predicate. If no item satisfies that condition, the default value for T is returned.

Remarks

If the default value for T (null or all-zero) matches the condition defined by predicate, and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFind(Predicate<(Of <<'(T>)>>), T%).

See Also

ListBase<(Of <(<'T>)>)> Class
Wintellect.PowerCollections Namespace
ListBase<(Of <(<'T>)>)>..::..TryFind(Predicate<(Of <<'(T>)>>), T%)


FindIndex Method

ListBase<(Of <(<'T>)>)>..::..FindIndex Method

Overload List

 | Name | Description
Public method | FindIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
ListBase<(Of <(<'T>)>)> Members


FindIndex Method (Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindIndex Method (Predicate<(Of <(<'T>)>)>)

Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindIndex Method (Int32, Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindIndex Method (Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    int index,
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    index As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    int^ index,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The starting index of the range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindIndex Method (Int32, Int32, Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindIndex Method (Int32, Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    int index,
    int count,
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    index As Integer, _
    count As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    int^ index,
    int^ count,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The starting index of the range to check.
count
Type: Int32
The number of items in range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindLast Method

ListBase<(Of <(<'T>)>)>..::..FindLast Method

Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T FindLast(
    Predicate<T> predicate
)
Public Overridable Function FindLast ( _
    predicate As Predicate(Of T) _
) As T
public:
virtual T FindLast(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The last item that satisfies the condition predicate. If no item satisfies that condition, the default value for T is returned.

Remarks

If the default value for T (null or all-zero) matches the condition defined by predicate, and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFindLast(Predicate<(Of <<'(T>)>>), T%).

See Also

ListBase<(Of <(<'T>)>)> Class
Wintellect.PowerCollections Namespace
ListBase<(Of <(<'T>)>)>..::..TryFindLast(Predicate<(Of <<'(T>)>>), T%)


FindLastIndex Method

ListBase<(Of <(<'T>)>)>..::..FindLastIndex Method

Overload List

 | Name | Description
Public method | FindLastIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
ListBase<(Of <(<'T>)>)> Members


FindLastIndex Method (Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Predicate<(Of <(<'T>)>)>)

Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


FindLastIndex Method (Int32, Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    int index,
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    index As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    int^ index,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The ending index of the range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


FindLastIndex Method (Int32, Int32, Predicate(T))

ListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Int32, Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    int index,
    int count,
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    index As Integer, _
    count As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    int^ index,
    int^ count,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The ending index of the range to check.
count
Type: Int32
The number of items in range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


GetEnumerator Method

ListBase<(Of <(<'T>)>)>..::..GetEnumerator Method

Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> that enumerates all the items in the list.

Remarks

The enumerator does not check for changes made to the structure of the list. Thus, changes to the list during enumeration may cause incorrect enumeration or out of range exceptions. Consider overriding this method and adding checks for structural changes.

See Also

ListBase<(Of <(<'T>)>)> Class


IndexOf Method

ListBase<(Of <(<'T>)>)>..::..IndexOf Method

Overload List

 | Name | Description
Public method | IndexOf(T) | Finds the index of the first item in the list that is equal to item.
Public method | IndexOf(T, Int32) | Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method | IndexOf(T, Int32, Int32) | Finds the index of the first item, in the range of count items starting from index, that is equal to item.

See Also

ListBase<(Of <(<'T>)>)> Class
ListBase<(Of <(<'T>)>)> Members


IndexOf Method (T)

ListBase<(Of <(<'T>)>)>..::..IndexOf Method (T)

Finds the index of the first item in the list that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item
)
Public Overridable Function IndexOf ( _
    item As T _
) As Integer
public:
virtual int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to search fror.

Return Value

The index of the first item in the list that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
IndexOf Overload


IndexOf Method (T, Int32)

ListBase<(Of <(<'T>)>)>..::..IndexOf Method (T, Int32)

Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item,
    int index
)
Public Overridable Function IndexOf ( _
    item As T, _
    index As Integer _
) As Integer
public:
virtual int^ IndexOf(
    T item,
    int^ index
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The starting index of the range to check.

Return Value

The index of the first item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
IndexOf Overload


IndexOf Method (T, Int32, Int32)

ListBase<(Of <(<'T>)>)>..::..IndexOf Method (T, Int32, Int32)

Finds the index of the first item, in the range of count items starting from index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item,
    int index,
    int count
)
Public Overridable Function IndexOf ( _
    item As T, _
    index As Integer, _
    count As Integer _
) As Integer
public:
virtual int^ IndexOf(
    T item,
    int^ index,
    int^ count
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The starting index of the range to check.
count
Type: Int32
The number of items in range to check.

Return Value

The index of the first item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
IndexOf Overload


Insert Method

ListBase<(Of <(<'T>)>)>..::..Insert Method

This method must be overridden by the derived class to insert a new item at the given index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Insert(
    int index,
    T item
)
Public Sub Insert ( _
    index As Integer, _
    item As T _
)
public:
void Insert(
    int^ index,
    T item
)

Parameters

index
Type: Int32
The index in the list to insert the item at. After the insertion, the inserted item is located at this index. The first item in the list has index 0.
item
Type: T
The item to insert at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than Count.

See Also

ListBase<(Of <(<'T>)>)> Class


LastIndexOf Method

ListBase<(Of <(<'T>)>)>..::..LastIndexOf Method

Overload List

 | Name | Description
Public method | LastIndexOf(T) | Finds the index of the last item in the list that is equal to item.
Public method | LastIndexOf(T, Int32) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method | LastIndexOf(T, Int32, Int32) | Finds the index of the last item, in the range of count items ending at index, that is equal to item.

See Also

ListBase<(Of <(<'T>)>)> Class
ListBase<(Of <(<'T>)>)> Members


LastIndexOf Method (T)

ListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T)

Finds the index of the last item in the list that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item
)
Public Overridable Function LastIndexOf ( _
    item As T _
) As Integer
public:
virtual int^ LastIndexOf(
    T item
)

Parameters

item
Type: T
The item to search fror.

Return Value

The index of the last item in the list that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


LastIndexOf Method (T, Int32)

ListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T, Int32)

Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item,
    int index
)
Public Overridable Function LastIndexOf ( _
    item As T, _
    index As Integer _
) As Integer
public:
virtual int^ LastIndexOf(
    T item,
    int^ index
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The ending index of the range to check.

Return Value

The index of the last item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


LastIndexOf Method (T, Int32, Int32)

ListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T, Int32, Int32)

Finds the index of the last item, in the range of count items ending at index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item,
    int index,
    int count
)
Public Overridable Function LastIndexOf ( _
    item As T, _
    index As Integer, _
    count As Integer _
) As Integer
public:
virtual int^ LastIndexOf(
    T item,
    int^ index,
    int^ count
)

Parameters

item
Type: T
The item to search for.
index
Type: Int32
The ending index of the range to check.
count
Type: Int32
The number of items in range to check.

Return Value

The index of the last item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


Range Method

ListBase<(Of <(<'T>)>)>..::..Range Method

Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items. Changes to this list are reflected in the view, and vice versa. Insertions and deletions in the view change the size of the view, but insertions and deletions in the underlying list do not.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IList<T> Range(
    int start,
    int count
)
Public Overridable Function Range ( _
    start As Integer, _
    count As Integer _
) As IList(Of T)
public:
virtual IList<T>^ Range(
    int^ start,
    int^ count
)

Parameters

start
Type: Int32
The starting index of the view.
count
Type: Int32
The number of items in the view.

Return Value

A list that is a view onto the given sub-part of this list.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | start or count is negative.
ArgumentOutOfRangeException | start + count is greater than the size of the list.

Remarks

This method can be used to apply an algorithm to a portion of a list. For example:

C#
Algorithms.ReverseInPlace(deque.Range(3, 6))
 will reverse the 6 items beginning at index 3.

See Also

ListBase<(Of <(<'T>)>)> Class


Remove Method

ListBase<(Of <(<'T>)>)>..::..Remove Method

Searches the list for the first item that compares equal to item. If one is found, it is removed. Otherwise, the list is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove from the list.

Return Value

True if an item was found and removed that compared equal to item. False if no such item was in the list.

Remarks

Equality in the list is determined by the default sense of equality for T. If T implements IComparable<T>, the Equals method of that interface is used to determine equality. Otherwise, Object.Equals is used to determine equality.

See Also

ListBase<(Of <(<'T>)>)> Class


RemoveAt Method

ListBase<(Of <(<'T>)>)>..::..RemoveAt Method

This method must be overridden by the derived class to remove the item at the given index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void RemoveAt(
    int index
)
Public Sub RemoveAt ( _
    index As Integer _
)
public:
void RemoveAt(
    int^ index
)

Parameters

index
Type: Int32
The index in the list to remove the item at. The first item in the list has index 0.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

See Also

ListBase<(Of <(<'T>)>)> Class


TryFind Method

ListBase<(Of <(<'T>)>)>..::..TryFind Method

Finds the first item in the list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TryFind(
    Predicate<T> predicate,
    out T foundItem
)
Public Overridable Function TryFind ( _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
virtual bool^ TryFind(
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.
foundItem
Type: T %
If true is returned, this parameter receives the first item in the list that satifies the condition defined by predicate.

Return Value

True if an item that satisfies the condition predicate was found. False if no item in the list satisfies that condition.

See Also

ListBase<(Of <(<'T>)>)> Class


TryFindLast Method

ListBase<(Of <(<'T>)>)>..::..TryFindLast Method

Finds the last item in the list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TryFindLast(
    Predicate<T> predicate,
    out T foundItem
)
Public Overridable Function TryFindLast ( _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
virtual bool^ TryFindLast(
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.
foundItem
Type: T %
If true is returned, this parameter receives the last item in the list that satifies the condition defined by predicate.

Return Value

True if an item that satisfies the condition predicate was found. False if no item in the list satisfies that condition.

See Also

ListBase<(Of <(<'T>)>)> Class


ListBase(T) Properties

ListBase<(Of <(<'T>)>)> Properties

The ListBase<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | The property must be overridden by the derived class to return the number of items in the list.
Public property | Item | The indexer must be overridden by the derived class to get and set values of the list at a particular index.

See Also

ListBase<(Of <(<'T>)>)> Class


Count Property

ListBase<(Of <(<'T>)>)>..::..Count Property

The property must be overridden by the derived class to return the number of items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the list.

See Also

ListBase<(Of <(<'T>)>)> Class


Item Property

ListBase<(Of <(<'T>)>)>..::..Item Property

The indexer must be overridden by the derived class to get and set values of the list at a particular index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { }
Public Default Property Item ( _
    index As Integer _
) As T
public:
property T default[int^ index] {
}

Parameters

index
Type: Int32
The index in the list to get or set an item at. The first item in the list has index 0, and the last has index Count-1.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

See Also

ListBase<(Of <(<'T>)>)> Class


MultiDictionary(TKey, TValue) Class

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class

The MultiDictionary class that associates values with a key. Unlike an Dictionary, each key can have multiple values associated with it. When indexing an MultiDictionary, instead of a single value associated with a key, you retrieve an enumeration of values.

When constructed, you can chose to allow the same value to be associated with a key multiple times, or only one time.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class MultiDictionary<TKey, TValue> : MultiDictionaryBase<TKey, TValue>

<SerializableAttribute> _
Public Class MultiDictionary(Of TKey, TValue) _
    Inherits MultiDictionaryBase(Of TKey, TValue)
[SerializableAttribute]
generic<typename TKey, typename TValue>
public ref class MultiDictionary : public MultiDictionaryBase<TKey, TValue>

Type Parameters

TKey
The type of the keys.
TValue
The of values associated with the keys.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>>)>)>
Wintellect.PowerCollections..::..MultiDictionaryBase <(Of <(<'TKey, TValue>)>)>
Wintellect.PowerCollections..::..MultiDictionary<(Of <(<'TKey, TValue>)>)>

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Members
Wintellect.PowerCollections Namespace
Dictionary
Wintellect.PowerCollections..::..OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>


MultiDictionary(TKey, TValue) Members

MultiDictionary<(Of <(<'TKey, TValue>)>)> Members

The MultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean) | Create a new MultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IEqualityComparer<(Of <<'(TKey>)>>)) | Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IEqualityComparer<(Of <<'(TKey>)>>), IEqualityComparer<(Of <<'(TValue>)>>)) | Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Methods

 | Name | Description
Public method | Add | Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary. If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Checks to see if value is associated with key in the dictionary.
Public method | ContainsKey | Checks to see if the key is present in the dictionary and has at least one value associated with it.
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

Properties

 | Name | Description
Public property | Count | Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.
Public property | KeyComparer | Returns the IEqualityComparer<T> used to compare keys in this dictionary.
Public property | ValueComparer | Returns the IEqualityComparer<T> used to compare values in this dictionary.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


MultiDictionary(TKey, TValue) Constructor

MultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor

Overload List

 | Name | Description
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean) | Create a new MultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IEqualityComparer<(Of <<'(TKey>)>>)) | Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | MultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IEqualityComparer<(Of <<'(TKey>)>>), IEqualityComparer<(Of <<'(TValue>)>>)) | Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
MultiDictionary<(Of <(<'TKey, TValue>)>)> Members


MultiDictionary(TKey, TValue) Constructor (Boolean)

MultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean)

Create a new MultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public MultiDictionary(
    bool allowDuplicateValues
)
Public Sub New ( _
    allowDuplicateValues As Boolean _
)
public:
MultiDictionary(
    bool^ allowDuplicateValues
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?

Exceptions

Exception | Condition
InvalidOperationException | TKey or TValue does not implement either IComparable<T> or IComparable.

Remarks

The default ordering of keys and values will be used, as defined by TKey and TValue's implementation of IComparable<T> (or IComparable if IComparable<T> is not implemented). If a different ordering should be used, other constructors allow a custom Comparer or IComparer to be passed to changed the ordering.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
MultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


MultiDictionary(TKey, TValue) Constructor (Boolean, IEqualityComparer(TKey))

MultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, IEqualityComparer<(Of <(<'TKey>)>)>)

Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public MultiDictionary(
    bool allowDuplicateValues,
    IEqualityComparer<TKey> keyEqualityComparer
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyEqualityComparer As IEqualityComparer(Of TKey) _
)
public:
MultiDictionary(
    bool^ allowDuplicateValues,
    IEqualityComparer<TKey>^ keyEqualityComparer
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyEqualityComparer
Type: IEqualityComparer <(Of <(<' TKey >)>)>
An IEqualityComparer<TKey> instance that will be used to compare keys.

Exceptions

Exception | Condition
InvalidOperationException | TValue does not implement either IComparable<TValue> or IComparable.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
MultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


MultiDictionary(TKey, TValue) Constructor (Boolean, IEqualityComparer(TKey), IEqualityComparer(TValue))

MultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, IEqualityComparer<(Of <(<'TKey>)>)>, IEqualityComparer<(Of <(<'TValue>)>)>)

Create a new MultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public MultiDictionary(
    bool allowDuplicateValues,
    IEqualityComparer<TKey> keyEqualityComparer,
    IEqualityComparer<TValue> valueEqualityComparer
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyEqualityComparer As IEqualityComparer(Of TKey), _
    valueEqualityComparer As IEqualityComparer(Of TValue) _
)
public:
MultiDictionary(
    bool^ allowDuplicateValues,
    IEqualityComparer<TKey>^ keyEqualityComparer,
    IEqualityComparer<TValue>^ valueEqualityComparer
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyEqualityComparer
Type: IEqualityComparer <(Of <(<' TKey >)>)>
An IEqualityComparer<TKey> instance that will be used to compare keys.
valueEqualityComparer
Type: IEqualityComparer <(Of <(<' TValue >)>)>
An IEqualityComparer<TValue> instance that will be used to compare values.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
MultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


MultiDictionary(TKey, TValue) Methods

MultiDictionary<(Of <(<'TKey, TValue>)>)> Methods

The MultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary. If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Checks to see if value is associated with key in the dictionary.
Public method | ContainsKey | Checks to see if the key is present in the dictionary and has at least one value associated with it.
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Add Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Add Method

Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary.

If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    TKey key,
    TValue value
)
Public Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to associate with.
value
Type: TValue
The value to associated with key.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Clear Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Clear Method

Removes all keys and values from the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Clone Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Clone Method

Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public MultiDictionary<TKey, TValue> Clone()
Public Function Clone As MultiDictionary(Of TKey, TValue)
public:
MultiDictionary<TKey, TValue>^ Clone()

Return Value

The cloned dictionary.

Remarks

Cloning the dictionary takes time O(N), where N is the number of key-value pairs in the dictionary.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


CloneContents Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..CloneContents Method

Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public MultiDictionary<TKey, TValue> CloneContents()
Public Function CloneContents As MultiDictionary(Of TKey, TValue)
public:
MultiDictionary<TKey, TValue>^ CloneContents()

Return Value

The cloned dictionary.

Exceptions

Exception | Condition
InvalidOperationException | TKey or TValue is a reference type that does not implement ICloneable.

Remarks

If TKey or TValue is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the dictionary takes time O(N log N), where N is the number of key-value pairs in the dictionary.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Contains Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Checks to see if value is associated with key in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    TKey key,
    TValue value
)
Public Function Contains ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Contains(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to check.
value
Type: TValue
The value to check.

Return Value

True if value is associated with key.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


ContainsKey Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Checks to see if the key is present in the dictionary and has at least one value associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ContainsKey(
    TKey key
)
Public Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
The key to check.

Return Value

True if key is present and has at least one value associated with it. Returns false otherwise.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Remove Method

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Overload List

 | Name | Description
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
MultiDictionary<(Of <(<'TKey, TValue>)>)> Members


Remove Method (TKey, TValue)

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey, TValue)

Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key,
    TValue value
)
Public Function Remove ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Remove(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
A key to remove a value from.
value
Type: TValue
The value to remove.

Return Value

True if value was associated with key (and was therefore removed). False if value was not associated with key.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Remove Method (TKey)

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey)

Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
The key to remove.

Return Value

True if the key was present and was removed. Returns false if the key was not present.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


MultiDictionary(TKey, TValue) Properties

MultiDictionary<(Of <(<'TKey, TValue>)>)> Properties

The MultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.
Public property | KeyComparer | Returns the IEqualityComparer<T> used to compare keys in this dictionary.
Public property | ValueComparer | Returns the IEqualityComparer<T> used to compare values in this dictionary.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Count Property

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Count Property

Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of key-value pairs in the dictionary.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


KeyComparer Property

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..KeyComparer Property

Returns the IEqualityComparer<T> used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEqualityComparer<TKey> KeyComparer { get; }
Public ReadOnly Property KeyComparer As IEqualityComparer(Of TKey)
    Get
public:
property IEqualityComparer<TKey>^ KeyComparer {
    IEqualityComparer<TKey>^ get ();
}

Field Value

If the dictionary was created using a comparer, that comparer is returned. Otherwise the default comparer for TKey (EqualityComparer<TKey>.Default) is returned.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


ValueComparer Property

MultiDictionary<(Of <(<'TKey, TValue>)>)>..::..ValueComparer Property

Returns the IEqualityComparer<T> used to compare values in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEqualityComparer<TValue> ValueComparer { get; }
Public ReadOnly Property ValueComparer As IEqualityComparer(Of TValue)
    Get
public:
property IEqualityComparer<TValue>^ ValueComparer {
    IEqualityComparer<TValue>^ get ();
}

Field Value

If the dictionary was created using a comparer, that comparer is returned. Otherwise the default comparer for TValue (EqualityComparer<TValue>.Default) is returned.

See Also

MultiDictionary<(Of <(<'TKey, TValue>)>)> Class


MultiDictionaryBase(TKey, TValue) Class

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class

MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class MultiDictionaryBase<TKey, TValue> : CollectionBase<KeyValuePair<TKey, ICollection<TValue>>>

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class MultiDictionaryBase(Of TKey, TValue) _
    Inherits CollectionBase(Of KeyValuePair(Of TKey, ICollection(Of TValue)))
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename TKey, typename TValue>
public ref class MultiDictionaryBase abstract : public CollectionBase<KeyValuePair<TKey, ICollection<TValue>^>^>

Type Parameters

TKey
The key type of the dictionary.
TValue
The value type of the dictionary.

Remarks

To use MultiDictionaryBase as a base class, the derived class must override Count, Clear, Add, Remove(TKey), Remove(TKey,TValue), Contains(TKey,TValue), EnumerateKeys, and TryEnumerateValuesForKey.

It may wish consider overriding CountValues, CountAllValues, ContainsKey, and EqualValues, but these are not required.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<'TKey, ICollection <(Of <(<'TValue>)>)>>)>)>>)>)>
Wintellect.PowerCollections..::..MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


MultiDictionaryBase(TKey, TValue) Members

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members

The MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Adds a key-value pair to the collection. The value part of the pair must be a collection of values to associate with the key. If values are already associated with the given key, the new values are added to the ones associated with that key.
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary. This method must be overridden in the derived class.
Public method | AddMany | Adds new values to be associated with a key. If duplicate values are permitted, this method always adds new key-value pairs to the dictionary. If duplicate values are not permitted, and key already has a value equal to one of values associated with it, then that value is replaced, and the number of values associate with key is unchanged.
Public method | Clear | Clears the dictionary. This method must be overridden in the derived class.
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | GetEnumerator | Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(TKey, TValue) | Removes a key-value pair from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Removes a set of values from a given key. If all values associated with a key are removed, then the key is removed also.
Public method | RemoveMany(TKey, IEnumerable<(Of <<'(TValue>)>>)) | Removes a collection of values from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | RemoveMany(IEnumerable<(Of <<'(TKey>)>>)) | Remove all of the keys (and any associated values) in a collection of keys. If a key is not present in the dictionary, nothing happens.
Public method | Replace | Replaces all values associated with key with the single value value.
Public method | ReplaceMany | Replaces all values associated with key with a new collection of values. If the collection does not permit duplicate values, and values has duplicate items, then only the last of duplicates is added.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Properties

 | Name | Description
Public property | Count | Gets the number of keys in the dictionary. This property must be overridden in the derived class.
Public property | Item | Returns a collection of all of the values in the dictionary associated with key, or changes the set of values associated with key. If the key is not present in the dictionary, an ICollection enumerating no values is returned. The returned collection of values is read-write, and can be used to modify the collection of values associated with the key.
Public property | Keys | Gets a read-only collection all the keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | Values | Gets a read-only collection of all the values in the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


MultiDictionaryBase(TKey, TValue) Methods

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Methods

The MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Adds a key-value pair to the collection. The value part of the pair must be a collection of values to associate with the key. If values are already associated with the given key, the new values are added to the ones associated with that key.
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary. This method must be overridden in the derived class.
Public method | AddMany | Adds new values to be associated with a key. If duplicate values are permitted, this method always adds new key-value pairs to the dictionary. If duplicate values are not permitted, and key already has a value equal to one of values associated with it, then that value is replaced, and the number of values associate with key is unchanged.
Public method | Clear | Clears the dictionary. This method must be overridden in the derived class.
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | GetEnumerator | Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(TKey, TValue) | Removes a key-value pair from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Removes a set of values from a given key. If all values associated with a key are removed, then the key is removed also.
Public method | RemoveMany(TKey, IEnumerable<(Of <<'(TValue>)>>)) | Removes a collection of values from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | RemoveMany(IEnumerable<(Of <<'(TKey>)>>)) | Remove all of the keys (and any associated values) in a collection of keys. If a key is not present in the dictionary, nothing happens.
Public method | Replace | Replaces all values associated with key with the single value value.
Public method | ReplaceMany | Replaces all values associated with key with a new collection of values. If the collection does not permit duplicate values, and values has duplicate items, then only the last of duplicates is added.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Add Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method

Overload List

 | Name | Description
Public method | Add(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Adds a key-value pair to the collection. The value part of the pair must be a collection of values to associate with the key. If values are already associated with the given key, the new values are added to the ones associated with that key.
Public method | Add(TKey, TValue) | Adds a new key-value pair to the dictionary. This method must be overridden in the derived class.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Add Method (KeyValuePair(TKey, ICollection(TValue)))

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method (KeyValuePair<(Of <(<'TKey, ICollection<(Of <(<'TValue>)>)>>)>)>)

Adds a key-value pair to the collection. The value part of the pair must be a collection of values to associate with the key. If values are already associated with the given key, the new values are added to the ones associated with that key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    KeyValuePair<TKey, ICollection<TValue>> item
)
Public Sub Add ( _
    item As KeyValuePair(Of TKey, ICollection(Of TValue)) _
)
public:
void Add(
    KeyValuePair<TKey, ICollection<TValue>^>^ item
)

Parameters

item
Type: KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>
A KeyValuePair contains the Key and Value collection to add.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Add Overload


Add Method (TKey, TValue)

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Add Method (TKey, TValue)

Adds a new key-value pair to the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    TKey key,
    TValue value
)
Public Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
Key to add.
value
Type: TValue
Value to associated with the key.

Exceptions

Exception | Condition
ArgumentException | key is already present in the dictionary

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Add Overload


AddMany Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..AddMany Method

Adds new values to be associated with a key. If duplicate values are permitted, this method always adds new key-value pairs to the dictionary.

If duplicate values are not permitted, and key already has a value equal to one of values associated with it, then that value is replaced, and the number of values associate with key is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void AddMany(
    TKey key,
    IEnumerable<TValue> values
)
Public Overridable Sub AddMany ( _
    key As TKey, _
    values As IEnumerable(Of TValue) _
)
public:
virtual void AddMany(
    TKey key,
    IEnumerable<TValue>^ values
)

Parameters

key
Type: TKey
The key to associate with.
values
Type: IEnumerable <(Of <(<' TValue >)>)>
A collection of values to associate with key.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Clear Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Clear Method

Clears the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Contains Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Overload List

 | Name | Description
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Contains Method (TKey, TValue)

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method (TKey, TValue)

Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    TKey key,
    TValue value
)
Public Function Contains ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Contains(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue
The value to search for.

Return Value

True if the dictionary has associated value with key.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Contains Overload


Contains Method (KeyValuePair(TKey, ICollection(TValue)))

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method (KeyValuePair<(Of <(<'TKey, ICollection<(Of <(<'TValue>)>)>>)>)>)

Determines if this dictionary contains the given key and all of the values associated with that key..

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    KeyValuePair<TKey, ICollection<TValue>> pair
)
Public Function Contains ( _
    pair As KeyValuePair(Of TKey, ICollection(Of TValue)) _
) As Boolean
public:
bool^ Contains(
    KeyValuePair<TKey, ICollection<TValue>^>^ pair
)

Parameters

pair
Type: KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>
A key and collection of values to search for.

Return Value

True if the dictionary has associated all of the values in pair.Value with pair.Key.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Contains Overload


ContainsKey Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Determines whether a given key is found in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool ContainsKey(
    TKey key
)
Public Overridable Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
virtual bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to look for in the dictionary.

Return Value

True if the key is present in the dictionary.

Remarks

The default implementation simply calls TryEnumerateValuesForKey. It may be appropriate to override this method to provide a more efficient implementation.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


GetEnumerator Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..GetEnumerator Method

Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<KeyValuePair<TKey, ICollection<TValue>>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of TKey, ICollection(Of TValue)))
public:
IEnumerator<KeyValuePair<TKey, ICollection<TValue>^>^>^ GetEnumerator()

Return Value

An enumerator to enumerate all the key, ICollection<value> pairs in the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Remove Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Overload List

 | Name | Description
Public method | Remove(TKey) | Removes a key from the dictionary. This method must be overridden in the derived class.
Public method | Remove(TKey, TValue) | Removes a key-value pair from the dictionary. This method must be overridden in the derived class.
Public method | Remove(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Removes a set of values from a given key. If all values associated with a key are removed, then the key is removed also.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Remove Method (TKey)

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey)

Removes a key from the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
Key to remove from the dictionary.

Return Value

True if the key was found, false otherwise.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Remove Method (TKey, TValue)

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey, TValue)

Removes a key-value pair from the dictionary. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key,
    TValue value
)
Public Function Remove ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Remove(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
Key to remove from the dictionary.
value
Type: TValue
Associated value to remove from the dictionary.

Return Value

True if the key-value pair was found, false otherwise.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Remove Method (KeyValuePair(TKey, ICollection(TValue)))

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method (KeyValuePair<(Of <(<'TKey, ICollection<(Of <(<'TValue>)>)>>)>)>)

Removes a set of values from a given key. If all values associated with a key are removed, then the key is removed also.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    KeyValuePair<TKey, ICollection<TValue>> pair
)
Public Function Remove ( _
    pair As KeyValuePair(Of TKey, ICollection(Of TValue)) _
) As Boolean
public:
bool^ Remove(
    KeyValuePair<TKey, ICollection<TValue>^>^ pair
)

Parameters

pair
Type: KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>
A KeyValuePair contains a key and a set of values to remove from that key.

Return Value

True if at least one values was found and removed.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


RemoveMany Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..RemoveMany Method

Overload List

 | Name | Description
Public method | RemoveMany(TKey, IEnumerable<(Of <<'(TValue>)>>)) | Removes a collection of values from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | RemoveMany(IEnumerable<(Of <<'(TKey>)>>)) | Remove all of the keys (and any associated values) in a collection of keys. If a key is not present in the dictionary, nothing happens.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


RemoveMany Method (TKey, IEnumerable(TValue))

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..RemoveMany Method (TKey, IEnumerable<(Of <(<'TValue>)>)>)

Removes a collection of values from the values associated with a key. If the last value is removed from a key, the key is removed also.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int RemoveMany(
    TKey key,
    IEnumerable<TValue> values
)
Public Overridable Function RemoveMany ( _
    key As TKey, _
    values As IEnumerable(Of TValue) _
) As Integer
public:
virtual int^ RemoveMany(
    TKey key,
    IEnumerable<TValue>^ values
)

Parameters

key
Type: TKey
A key to remove values from.
values
Type: IEnumerable <(Of <(<' TValue >)>)>
A collection of values to remove.

Return Value

The number of values that were present and removed.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
RemoveMany Overload


RemoveMany Method (IEnumerable(TKey))

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..RemoveMany Method (IEnumerable<(Of <(<'TKey>)>)>)

Remove all of the keys (and any associated values) in a collection of keys. If a key is not present in the dictionary, nothing happens.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<TKey> keyCollection
)
Public Function RemoveMany ( _
    keyCollection As IEnumerable(Of TKey) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<TKey>^ keyCollection
)

Parameters

keyCollection
Type: IEnumerable <(Of <(<' TKey >)>)>
A collection of key values to remove.

Return Value

The number of keys from the collection that were present and removed.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
RemoveMany Overload


Replace Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Replace Method

Replaces all values associated with key with the single value value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Replace(
    TKey key,
    TValue value
)
Public Overridable Function Replace ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
virtual bool^ Replace(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to associate with.
value
Type: TValue
The new values to be associated with key.

Return Value

Returns true if some values were removed. Returns false if key was not present in the dictionary before Replace was called.

Remarks

This implementation simply calls Remove, followed by Add.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReplaceMany Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ReplaceMany Method

Replaces all values associated with key with a new collection of values. If the collection does not permit duplicate values, and values has duplicate items, then only the last of duplicates is added.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ReplaceMany(
    TKey key,
    IEnumerable<TValue> values
)
Public Function ReplaceMany ( _
    key As TKey, _
    values As IEnumerable(Of TValue) _
) As Boolean
public:
bool^ ReplaceMany(
    TKey key,
    IEnumerable<TValue>^ values
)

Parameters

key
Type: TKey
The key to associate with.
values
Type: IEnumerable <(Of <(<' TValue >)>)>
The new values to be associated with key.

Return Value

Returns true if some values were removed. Returns false if key was not present in the dictionary before Replace was called.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ToString Method

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ToString Method

Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


MultiDictionaryBase(TKey, TValue) Properties

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Properties

The MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Gets the number of keys in the dictionary. This property must be overridden in the derived class.
Public property | Item | Returns a collection of all of the values in the dictionary associated with key, or changes the set of values associated with key. If the key is not present in the dictionary, an ICollection enumerating no values is returned. The returned collection of values is read-write, and can be used to modify the collection of values associated with the key.
Public property | Keys | Gets a read-only collection all the keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | Values | Gets a read-only collection of all the values in the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Count Property

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Count Property

Gets the number of keys in the dictionary. This property must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Item Property

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Item Property

Returns a collection of all of the values in the dictionary associated with key, or changes the set of values associated with key. If the key is not present in the dictionary, an ICollection enumerating no values is returned. The returned collection of values is read-write, and can be used to modify the collection of values associated with the key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> this[
    TKey key
] { get; set; }
Public Overridable Default Property Item ( _
    key As TKey _
) As ICollection(Of TValue)
    Get
    Set
public:
virtual property ICollection<TValue>^ default[TKey key] {
    ICollection<TValue>^ get (TKey key);
    void set (TKey key, ICollection<TValue>^ value);
}

Parameters

key
Type: TKey
The key to get the values associated with.

Field Value

An ICollection<TValue> with all the values associated with key.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Keys Property

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Keys Property

Gets a read-only collection all the keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TKey> Keys { get; }
Public Overridable ReadOnly Property Keys As ICollection(Of TKey)
    Get
public:
virtual property ICollection<TKey>^ Keys {
    ICollection<TKey>^ get ();
}

Field Value

An readonly ICollection<TKey> of all the keys in this dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


KeyValuePairs Property

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..KeyValuePairs Property

Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<KeyValuePair<TKey, TValue>> KeyValuePairs { get; }
Public Overridable ReadOnly Property KeyValuePairs As ICollection(Of KeyValuePair(Of TKey, TValue))
    Get
public:
virtual property ICollection<KeyValuePair<TKey, TValue>^>^ KeyValuePairs {
    ICollection<KeyValuePair<TKey, TValue>^>^ get ();
}

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Values Property

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Values Property

Gets a read-only collection of all the values in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> Values { get; }
Public Overridable ReadOnly Property Values As ICollection(Of TValue)
    Get
public:
virtual property ICollection<TValue>^ Values {
    ICollection<TValue>^ get ();
}

Return Value

A read-only ICollection<TValue> of all the values in the dictionary.

See Also

MultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


OrderedBag(T) Class

OrderedBag<(Of <(<'T>)>)> Class

OrderedBag<T> is a collection that contains items of type T. The item are maintained in a sorted order. Unlike a OrderedSet, duplicate items (items that compare equal to each other) are allows in an OrderedBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class OrderedBag<T> : CollectionBase<T>

<SerializableAttribute> _
Public Class OrderedBag(Of T) _
    Inherits CollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class OrderedBag : public CollectionBase<T>

Type Parameters

T

Remarks

The items are compared in one of three ways. If T implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.

OrderedBag is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) + M time, where N is the number of keys in the tree, and M is the current number of copies of the element being handled.

Bag<(Of <(<'T>)>)> is similar, but uses hashing instead of comparison, and does not maintain the keys in sorted order.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..OrderedBag<(Of <(<'T>)>)>

See Also

OrderedBag<(Of <(<'T>)>)> Members
Wintellect.PowerCollections Namespace
Wintellect.PowerCollections..::..Bag<(Of <(<'T>)>)>


OrderedBag(T) Members

OrderedBag<(Of <(<'T>)>)> Members

The OrderedBag<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | OrderedBag<(Of <(<'T>)>)>()()()() | Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(Comparison<(Of <<'(T>)>>)) | Creates a new OrderedBag. The passed delegate will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(IComparer<(Of <<'(T>)>>)) | Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag. The bag is initialized with all the items in the given collection.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a new OrderedBag. The passed delegate will be used to compare items in this bag. The bag is initialized with all the items in the given collection.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the new item is placed after all equal items already present in the bag.
Public method | AddMany | Adds all the items in collection to the bag.
Public method | AsList | Get a read-only list view of the items in this ordered bag. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedBag.
Public method | Clear | Removes all items from the bag.
Public method | Clone | Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Determines if this bag contains an item equal to item. The bag is not changed.
Public method | Difference | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | DifferenceWith | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.
Public method | DistinctItems | Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.
Public method | GetEnumerator | Returns an enumerator that enumerates all the items in the bag. The items are enumerated in sorted order.
Public method | GetEqualItems | Enumerates all of the items in this bag that are equal to item, according to the comparison mechanism that was used when the bag was created. The bag is not changed. If the bag does contain an item equal to item, then the enumeration contains no items.
Public method | GetFirst | Returns the first item in the bag: the item that would appear first if the bag was enumerated. This is also the smallest item in the bag.
Public method | GetLast | Returns the last item in the bag: the item that would appear last if the bag was enumerated. This is also the largest item in the bag.
Public method | IndexOf | Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the smallest index of the equal items is returned.
Public method | Intersection | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.
Public method | IntersectionWith | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.
Public method | IsDisjointFrom | Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.
Public method | IsEqualTo | Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same items, each the same number of times.
Public method | IsProperSubsetOf | Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.
Public method | IsProperSupersetOf | Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.
Public method | IsSubsetOf | Determines if this bag is a subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times.
Public method | IsSupersetOf | Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.
Public method | LastIndexOf | Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the largest index of the equal items is returned.
Public method | NumberOfCopies | Returns the number of copies of item in the bag. More precisely, returns the number of items in the bag that compare equal to item.
Public method | Range | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove | Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If more than one item equal to item, the item that was last inserted is removed.
Public method | RemoveAllCopies | Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.
Public method | RemoveFirst | Removes the first item in the bag. This is also the smallest item in the bag.
Public method | RemoveLast | Removes the last item in the bag. This is also the largest item in the bag.
Public method | RemoveMany | Removes all the items in collection from the bag. Items not present in the bag are ignored.
Public method | Reversed | Returns a View collection that can be used for enumerating the items in the bag in reversed order.
Public method | Sum | Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.
Public method | SumWith | Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.
Public method | SymmetricDifference | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | SymmetricDifferenceWith | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). This bag receives the symmetric difference of the two bags; the other bag is unchanged.
Public method | Union | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.
Public method | UnionWith | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare items in this bag.
Public property | Count | Returns the number of items in the bag.
Public property | Item | Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedBag<(Of <(<'T>)>)> Class


OrderedBag(T) Constructor

OrderedBag<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | OrderedBag<(Of <(<'T>)>)>()()()() | Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(Comparison<(Of <<'(T>)>>)) | Creates a new OrderedBag. The passed delegate will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(IComparer<(Of <<'(T>)>>)) | Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag. The bag is initialized with all the items in the given collection.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a new OrderedBag. The passed delegate will be used to compare items in this bag. The bag is initialized with all the items in the given collection.
Public method | OrderedBag<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Members


OrderedBag(T) Constructor

OrderedBag<(Of <(<'T>)>)> Constructor

Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag()
Public Sub New
public:
OrderedBag()

Exceptions

Exception | Condition
InvalidOperationException | T does not implement IComparable<TKey>.

Remarks

Items that are null are permitted, and will be sorted before all other items.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Constructor (Comparison(T))

OrderedBag<(Of <(<'T>)>)> Constructor (Comparison<(Of <(<'T>)>)>)

Creates a new OrderedBag. The passed delegate will be used to compare items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag(
    Comparison<T> comparison
)
Public Sub New ( _
    comparison As Comparison(Of T) _
)
public:
OrderedBag(
    Comparison<T>^ comparison
)

Parameters

comparison
Type: Comparison <(Of <(<' T >)>)>
A delegate to a method that will be used to compare items.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Constructor (IComparer(T))

OrderedBag<(Of <(<'T>)>)> Constructor (IComparer<(Of <(<'T>)>)>)

Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag(
    IComparer<T> comparer
)
Public Sub New ( _
    comparer As IComparer(Of T) _
)
public:
OrderedBag(
    IComparer<T>^ comparer
)

Parameters

comparer
Type: IComparer <(Of <(<' T >)>)>
An instance of IComparer<T> that will be used to compare items.

Remarks

The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Constructor (IEnumerable(T))

OrderedBag<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Creates a new OrderedBag. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
OrderedBag(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedBag.

Exceptions

Exception | Condition
InvalidOperationException | T does not implement IComparable<TKey>.

Remarks

Items that are null are permitted, and will be sorted before all other items.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Constructor (IEnumerable(T), Comparison(T))

OrderedBag<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Creates a new OrderedBag. The passed delegate will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
)
public:
OrderedBag(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedBag.
comparison
Type: Comparison <(Of <(<' T >)>)>
A delegate to a method that will be used to compare items.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Constructor (IEnumerable(T), IComparer(T))

OrderedBag<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Creates a new OrderedBag. The Compare method of the passed comparison object will be used to compare items in this bag. The bag is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
)
public:
OrderedBag(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedBag.
comparer
Type: IComparer <(Of <(<' T >)>)>
An instance of IComparer<T> that will be used to compare items.

Remarks

The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.

See Also

OrderedBag<(Of <(<'T>)>)> Class
OrderedBag<(Of <(<'T>)>)> Overload


OrderedBag(T) Methods

OrderedBag<(Of <(<'T>)>)> Methods

The OrderedBag<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the new item is placed after all equal items already present in the bag.
Public method | AddMany | Adds all the items in collection to the bag.
Public method | AsList | Get a read-only list view of the items in this ordered bag. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedBag.
Public method | Clear | Removes all items from the bag.
Public method | Clone | Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Determines if this bag contains an item equal to item. The bag is not changed.
Public method | Difference | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | DifferenceWith | Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.
Public method | DistinctItems | Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.
Public method | GetEnumerator | Returns an enumerator that enumerates all the items in the bag. The items are enumerated in sorted order.
Public method | GetEqualItems | Enumerates all of the items in this bag that are equal to item, according to the comparison mechanism that was used when the bag was created. The bag is not changed. If the bag does contain an item equal to item, then the enumeration contains no items.
Public method | GetFirst | Returns the first item in the bag: the item that would appear first if the bag was enumerated. This is also the smallest item in the bag.
Public method | GetLast | Returns the last item in the bag: the item that would appear last if the bag was enumerated. This is also the largest item in the bag.
Public method | IndexOf | Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the smallest index of the equal items is returned.
Public method | Intersection | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.
Public method | IntersectionWith | Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.
Public method | IsDisjointFrom | Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.
Public method | IsEqualTo | Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same items, each the same number of times.
Public method | IsProperSubsetOf | Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.
Public method | IsProperSupersetOf | Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.
Public method | IsSubsetOf | Determines if this bag is a subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times.
Public method | IsSupersetOf | Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.
Public method | LastIndexOf | Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the largest index of the equal items is returned.
Public method | NumberOfCopies | Returns the number of copies of item in the bag. More precisely, returns the number of items in the bag that compare equal to item.
Public method | Range | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove | Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If more than one item equal to item, the item that was last inserted is removed.
Public method | RemoveAllCopies | Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.
Public method | RemoveFirst | Removes the first item in the bag. This is also the smallest item in the bag.
Public method | RemoveLast | Removes the last item in the bag. This is also the largest item in the bag.
Public method | RemoveMany | Removes all the items in collection from the bag. Items not present in the bag are ignored.
Public method | Reversed | Returns a View collection that can be used for enumerating the items in the bag in reversed order.
Public method | Sum | Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.
Public method | SumWith | Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.
Public method | SymmetricDifference | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.
Public method | SymmetricDifferenceWith | Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). This bag receives the symmetric difference of the two bags; the other bag is unchanged.
Public method | Union | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.
Public method | UnionWith | Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Add Method

OrderedBag<(Of <(<'T>)>)>..::..Add Method

Adds a new item to the bag. Since bags can contain duplicate items, the item is added even if the bag already contains an item equal to item. In this case, the new item is placed after all equal items already present in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add to the bag.

Remarks

Adding an item takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


AddMany Method

OrderedBag<(Of <(<'T>)>)>..::..AddMany Method

Adds all the items in collection to the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddMany(
    IEnumerable<T> collection
)
Public Sub AddMany ( _
    collection As IEnumerable(Of T) _
)
public:
void AddMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to add to the bag.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Adding the collection takes time O(M log N), where N is the number of items in the bag, and M is the number of items in collection.

See Also

OrderedBag<(Of <(<'T>)>)> Class


AsList Method

OrderedBag<(Of <(<'T>)>)>..::..AsList Method

Get a read-only list view of the items in this ordered bag. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IList<T> AsList()
Public Function AsList As IList(Of T)
public:
IList<T>^ AsList()

Return Value

A read-only IList<T> view onto this OrderedBag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Clear Method

OrderedBag<(Of <(<'T>)>)>..::..Clear Method

Removes all items from the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the bag takes a constant amount of time, regardless of the number of items in it.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Clone Method

OrderedBag<(Of <(<'T>)>)>..::..Clone Method

Makes a shallow clone of this bag; i.e., if items of the bag are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> Clone()
Public Function Clone As OrderedBag(Of T)
public:
OrderedBag<T>^ Clone()

Return Value

The cloned bag.

Remarks

Cloning the bag takes time O(N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


CloneContents Method

OrderedBag<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this bag. A new bag is created with a clone of each element of this bag, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> CloneContents()
Public Function CloneContents As OrderedBag(Of T)
public:
OrderedBag<T>^ CloneContents()

Return Value

The cloned bag.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the bag takes time O(N log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Contains Method

OrderedBag<(Of <(<'T>)>)>..::..Contains Method

Determines if this bag contains an item equal to item. The bag is not changed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the bag contains item. False if the bag does not contain item.

Remarks

Searching the bag for an item takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Difference Method

OrderedBag<(Of <(<'T>)>)>..::..Difference Method

Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). A new bag is created with the difference of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> Difference(
    OrderedBag<T> otherBag
)
Public Function Difference ( _
    otherBag As OrderedBag(Of T) _
) As OrderedBag(Of T)
public:
OrderedBag<T>^ Difference(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to difference with.

Return Value

The difference of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The difference of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


DifferenceWith Method

OrderedBag<(Of <(<'T>)>)>..::..DifferenceWith Method

Computes the difference of this bag with another bag. The difference of these two bags is all items that appear in this bag, but not in otherBag. If an item appears X times in this bag, and Y times in the other bag, the difference contains the item X - Y times (zero times if Y >= X). This bag receives the difference of the two bags; the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void DifferenceWith(
    OrderedBag<T> otherBag
)
Public Sub DifferenceWith ( _
    otherBag As OrderedBag(Of T) _
)
public:
void DifferenceWith(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to difference with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The difference of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


DistinctItems Method

OrderedBag<(Of <(<'T>)>)>..::..DistinctItems Method

Enumerates all the items in the bag, but enumerates equal items just once, even if they occur multiple times in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerable<T> DistinctItems()
Public Function DistinctItems As IEnumerable(Of T)
public:
IEnumerable<T>^ DistinctItems()

Return Value

An IEnumerable<T> that enumerates the unique items.

Remarks

If the bag is changed while items are being enumerated, the enumeration will terminate with an InvalidOperationException.

See Also

OrderedBag<(Of <(<'T>)>)> Class


GetEnumerator Method

OrderedBag<(Of <(<'T>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the items in the bag. The items are enumerated in sorted order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An enumerator for enumerating all the items in the OrderedBag.

Remarks

Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.

If an item is added to or deleted from the bag while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumeration all the items in the bag takes time O(N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


GetEqualItems Method

OrderedBag<(Of <(<'T>)>)>..::..GetEqualItems Method

Enumerates all of the items in this bag that are equal to item, according to the comparison mechanism that was used when the bag was created. The bag is not changed.

If the bag does contain an item equal to item, then the enumeration contains no items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerable<T> GetEqualItems(
    T item
)
Public Function GetEqualItems ( _
    item As T _
) As IEnumerable(Of T)
public:
IEnumerable<T>^ GetEqualItems(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

An IEnumerable<T> that enumerates all the items in the bag equal to item.

Remarks

Enumeration the items in the bag equal to item takes time O(log N + M), where N is the total number of items in the bag, and M is the number of items equal to item.

See Also

OrderedBag<(Of <(<'T>)>)> Class


GetFirst Method

OrderedBag<(Of <(<'T>)>)>..::..GetFirst Method

Returns the first item in the bag: the item that would appear first if the bag was enumerated. This is also the smallest item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetFirst()
Public Function GetFirst As T
public:
T GetFirst()

Return Value

The first item in the bag. If more than one item is smallest, the first one added is returned.

Exceptions

Exception | Condition
InvalidOperationException | The bag is empty.

Remarks

GetFirst() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


GetLast Method

OrderedBag<(Of <(<'T>)>)>..::..GetLast Method

Returns the last item in the bag: the item that would appear last if the bag was enumerated. This is also the largest item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetLast()
Public Function GetLast As T
public:
T GetLast()

Return Value

The last item in the bag. If more than one item is largest, the last one added is returned.

Exceptions

Exception | Condition
InvalidOperationException | The bag is empty.

Remarks

GetLast() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IndexOf Method

OrderedBag<(Of <(<'T>)>)>..::..IndexOf Method

Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the smallest index of the equal items is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int IndexOf(
    T item
)
Public Function IndexOf ( _
    item As T _
) As Integer
public:
int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the first item in the sorted bag equal to item, or -1 if the item is not present in the set.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Intersection Method

OrderedBag<(Of <(<'T>)>)>..::..Intersection Method

Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. A new bag is created with the intersection of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> Intersection(
    OrderedBag<T> otherBag
)
Public Function Intersection ( _
    otherBag As OrderedBag(Of T) _
) As OrderedBag(Of T)
public:
OrderedBag<T>^ Intersection(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to intersection with.

Return Value

The intersection of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

When equal items appear in both bags, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two bags is computed in time O(N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IntersectionWith Method

OrderedBag<(Of <(<'T>)>)>..::..IntersectionWith Method

Computes the intersection of this bag with another bag. The intersection of two bags is all items that appear in both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item Minimum(X,Y) times. This bag receives the intersection of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void IntersectionWith(
    OrderedBag<T> otherBag
)
Public Sub IntersectionWith ( _
    otherBag As OrderedBag(Of T) _
)
public:
void IntersectionWith(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to intersection with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

When equal items appear in both bags, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two bags is computed in time O(N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsDisjointFrom Method

OrderedBag<(Of <(<'T>)>)>..::..IsDisjointFrom Method

Determines if this bag is disjoint from another bag. Two bags are disjoint if no item from one set is equal to any item in the other bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsDisjointFrom(
    OrderedBag<T> otherBag
)
Public Function IsDisjointFrom ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsDisjointFrom(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to check disjointness with.

Return Value

True if the two bags are disjoint, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

The answer is computed in time O(N), where N is the size of the smaller set.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsEqualTo Method

OrderedBag<(Of <(<'T>)>)>..::..IsEqualTo Method

Determines if this bag is equal to another bag. This bag is equal to otherBag if they contain the same items, each the same number of times.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsEqualTo(
    OrderedBag<T> otherBag
)
Public Function IsEqualTo ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsEqualTo(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
OrderedBag to compare to

Return Value

True if this bag is equal to otherBag, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.

Remarks

IsEqualTo is computed in time O(N), where N is the number of items in this bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsProperSubsetOf Method

OrderedBag<(Of <(<'T>)>)>..::..IsProperSubsetOf Method

Determines if this bag is a proper subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times. Additional, this bag must have strictly fewer items than otherBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSubsetOf(
    OrderedBag<T> otherBag
)
Public Function IsProperSubsetOf ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsProperSubsetOf(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
OrderedBag to compare to.

Return Value

True if this is a proper subset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

IsSubsetOf is computed in time O(N log M), where M is the size of the , and N is the size of the this bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsProperSupersetOf Method

OrderedBag<(Of <(<'T>)>)>..::..IsProperSupersetOf Method

Determines if this bag is a proper superset of another bag. Neither bag is modified. This bag is a proper superset of otherBag if every element in otherBag is also in this bag, at least the same number of times. Additional, this bag must have strictly more items than otherBag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSupersetOf(
    OrderedBag<T> otherBag
)
Public Function IsProperSupersetOf ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsProperSupersetOf(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
OrderedBag to compare to.

Return Value

True if this is a proper superset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

IsProperSupersetOf is computed in time O(M log N), where M is the number of unique items in otherBag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsSubsetOf Method

OrderedBag<(Of <(<'T>)>)>..::..IsSubsetOf Method

Determines if this bag is a subset of another bag. Neither bag is modified. This bag is a subset of otherBag if every element in this bag is also in otherBag, at least the same number of times.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSubsetOf(
    OrderedBag<T> otherBag
)
Public Function IsSubsetOf ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsSubsetOf(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
OrderedBag to compare to.

Return Value

True if this is a subset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

IsSubsetOf is computed in time O(N log M), where M is the size of the otherBag, and N is the size of the this bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


IsSupersetOf Method

OrderedBag<(Of <(<'T>)>)>..::..IsSupersetOf Method

Determines if this bag is a superset of another bag. Neither bag is modified. This bag is a superset of otherBag if every element in otherBag is also in this bag, at least the same number of times.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSupersetOf(
    OrderedBag<T> otherBag
)
Public Function IsSupersetOf ( _
    otherBag As OrderedBag(Of T) _
) As Boolean
public:
bool^ IsSupersetOf(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
OrderedBag to compare to.

Return Value

True if this is a superset of otherBag.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet, and N is the size of the this set.

See Also

OrderedBag<(Of <(<'T>)>)> Class


LastIndexOf Method

OrderedBag<(Of <(<'T>)>)>..::..LastIndexOf Method

Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1. If multiple equal items exist, the largest index of the equal items is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int LastIndexOf(
    T item
)
Public Function LastIndexOf ( _
    item As T _
) As Integer
public:
int^ LastIndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the last item in the sorted bag equal to item, or -1 if the item is not present in the set.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)> Class


NumberOfCopies Method

OrderedBag<(Of <(<'T>)>)>..::..NumberOfCopies Method

Returns the number of copies of item in the bag. More precisely, returns the number of items in the bag that compare equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int NumberOfCopies(
    T item
)
Public Function NumberOfCopies ( _
    item As T _
) As Integer
public:
int^ NumberOfCopies(
    T item
)

Parameters

item
Type: T
The item to search for in the bag.

Return Value

The number of items in the bag that compare equal to item.

Remarks

NumberOfCopies() takes time O(log N + M), where N is the total number of items in the bag, and M is the number of copies of item in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Range Method

OrderedBag<(Of <(<'T>)>)>..::..Range Method

Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<(Of <(<'T>)>)>..::..View Range(
    T from,
    bool fromInclusive,
    T to,
    bool toInclusive
)
Public Function Range ( _
    from As T, _
    fromInclusive As Boolean, _
    to As T, _
    toInclusive As Boolean _
) As OrderedBag<(Of <(<'T>)>)>..::..View
public:
OrderedBag<(Of <(<'T>)>)>..::..View^ Range(
    T from,
    bool^ fromInclusive,
    T to,
    bool^ toInclusive
)

Parameters

from
Type: T
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--items equal to the lower bound will be included in the range. If false, the lower bound is exclusive--items equal to the lower bound will not be included in the range.
to
Type: T
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--items equal to the upper bound will be included in the range. If false, the upper bound is exclusive--items equal to the upper bound will not be included in the range.

Return Value

An OrderedBag.View of items in the given range.

Remarks

If from is greater than or equal to to, the returned collection is empty.

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in bag.Range(from, true, to, false)) {
   // process item
}

If an item is added to or deleted from the bag while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Range does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RangeFrom Method

OrderedBag<(Of <(<'T>)>)>..::..RangeFrom Method

Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<(Of <(<'T>)>)>..::..View RangeFrom(
    T from,
    bool fromInclusive
)
Public Function RangeFrom ( _
    from As T, _
    fromInclusive As Boolean _
) As OrderedBag<(Of <(<'T>)>)>..::..View
public:
OrderedBag<(Of <(<'T>)>)>..::..View^ RangeFrom(
    T from,
    bool^ fromInclusive
)

Parameters

from
Type: T
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--items equal to the lower bound will be included in the range. If false, the lower bound is exclusive--items equal to the lower bound will not be included in the range.

Return Value

An OrderedBag.View of items in the given range.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in bag.RangeFrom(from, true)) {
   // process item
}

If an item is added to or deleted from the bag while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling RangeFrom does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RangeTo Method

OrderedBag<(Of <(<'T>)>)>..::..RangeTo Method

Returns a View collection that can be used for enumerating a range of the items in the bag. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<(Of <(<'T>)>)>..::..View RangeTo(
    T to,
    bool toInclusive
)
Public Function RangeTo ( _
    to As T, _
    toInclusive As Boolean _
) As OrderedBag<(Of <(<'T>)>)>..::..View
public:
OrderedBag<(Of <(<'T>)>)>..::..View^ RangeTo(
    T to,
    bool^ toInclusive
)

Parameters

to
Type: T
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--items equal to the upper bound will be included in the range. If false, the upper bound is exclusive--items equal to the upper bound will not be included in the range.

Return Value

An OrderedBag.View of items in the given range.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in bag.RangeTo(to, false)) {
   // process item
}

If an item is added to or deleted from the bag while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling RangeTo does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Remove Method

OrderedBag<(Of <(<'T>)>)>..::..Remove Method

Searches the bag for one item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If more than one item equal to item, the item that was last inserted is removed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the bag.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

Removing an item from the bag takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RemoveAllCopies Method

OrderedBag<(Of <(<'T>)>)>..::..RemoveAllCopies Method

Searches the bag for all items equal to item, and removes all of them from the bag. If not found, the bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveAllCopies(
    T item
)
Public Function RemoveAllCopies ( _
    item As T _
) As Integer
public:
int^ RemoveAllCopies(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

The number of copies of item that were found and removed.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

RemoveAllCopies() takes time O(M log N), where N is the total number of items in the bag, and M is the number of items equal to item.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RemoveFirst Method

OrderedBag<(Of <(<'T>)>)>..::..RemoveFirst Method

Removes the first item in the bag. This is also the smallest item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveFirst()
Public Function RemoveFirst As T
public:
T RemoveFirst()

Return Value

The item that was removed, which was the smallest item in the bag.

Exceptions

Exception | Condition
InvalidOperationException | The bag is empty.

Remarks

RemoveFirst() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RemoveLast Method

OrderedBag<(Of <(<'T>)>)>..::..RemoveLast Method

Removes the last item in the bag. This is also the largest item in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveLast()
Public Function RemoveLast As T
public:
T RemoveLast()

Return Value

The item that was removed, which was the largest item in the bag.

Exceptions

Exception | Condition
InvalidOperationException | The bag is empty.

Remarks

RemoveLast() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


RemoveMany Method

OrderedBag<(Of <(<'T>)>)>..::..RemoveMany Method

Removes all the items in collection from the bag. Items not present in the bag are ignored.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<T> collection
)
Public Function RemoveMany ( _
    collection As IEnumerable(Of T) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to remove from the bag.

Return Value

The number of items removed from the bag.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

Removing the collection takes time O(M log N), where N is the number of items in the bag, and M is the number of items in collection.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Reversed Method

OrderedBag<(Of <(<'T>)>)>..::..Reversed Method

Returns a View collection that can be used for enumerating the items in the bag in reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<(Of <(<'T>)>)>..::..View Reversed()
Public Function Reversed As OrderedBag<(Of <(<'T>)>)>..::..View
public:
OrderedBag<(Of <(<'T>)>)>..::..View^ Reversed()

Return Value

An OrderedBag.View of items in reverse order.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in bag.Reversed()) {
   // process item
}

If an item is added to or deleted from the bag while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Reverse does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Sum Method

OrderedBag<(Of <(<'T>)>)>..::..Sum Method

Computes the sum of this bag with another bag. he sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. A new bag is created with the sum of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> Sum(
    OrderedBag<T> otherBag
)
Public Function Sum ( _
    otherBag As OrderedBag(Of T) _
) As OrderedBag(Of T)
public:
OrderedBag<T>^ Sum(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to sum with.

Return Value

The sum of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The sum of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


SumWith Method

OrderedBag<(Of <(<'T>)>)>..::..SumWith Method

Computes the sum of this bag with another bag. The sum of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the sum contains the item (X+Y) times. This bag receives the sum of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SumWith(
    OrderedBag<T> otherBag
)
Public Sub SumWith ( _
    otherBag As OrderedBag(Of T) _
)
public:
void SumWith(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to sum with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The sum of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


SymmetricDifference Method

OrderedBag<(Of <(<'T>)>)>..::..SymmetricDifference Method

Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). A new bag is created with the symmetric difference of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> SymmetricDifference(
    OrderedBag<T> otherBag
)
Public Function SymmetricDifference ( _
    otherBag As OrderedBag(Of T) _
) As OrderedBag(Of T)
public:
OrderedBag<T>^ SymmetricDifference(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to symmetric difference with.

Return Value

The symmetric difference of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The symmetric difference of two bags is computed in time O(M + N), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


SymmetricDifferenceWith Method

OrderedBag<(Of <(<'T>)>)>..::..SymmetricDifferenceWith Method

Computes the symmetric difference of this bag with another bag. The symmetric difference of two bags is all items that appear in either of the bags, but not both. If an item appears X times in one bag, and Y times in the other bag, the symmetric difference contains the item AbsoluteValue(X - Y times). This bag receives the symmetric difference of the two bags; the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SymmetricDifferenceWith(
    OrderedBag<T> otherBag
)
Public Sub SymmetricDifferenceWith ( _
    otherBag As OrderedBag(Of T) _
)
public:
void SymmetricDifferenceWith(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to symmetric difference with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The symmetric difference of two bags is computed in time O(M + N), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Union Method

OrderedBag<(Of <(<'T>)>)>..::..Union Method

Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. A new bag is created with the union of the bags and is returned. This bag and the other bag are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<T> Union(
    OrderedBag<T> otherBag
)
Public Function Union ( _
    otherBag As OrderedBag(Of T) _
) As OrderedBag(Of T)
public:
OrderedBag<T>^ Union(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to union with.

Return Value

The union of the two bags.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The union of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


UnionWith Method

OrderedBag<(Of <(<'T>)>)>..::..UnionWith Method

Computes the union of this bag with another bag. The union of two bags is all items from both of the bags. If an item appears X times in one bag, and Y times in the other bag, the union contains the item Maximum(X,Y) times. This bag receives the union of the two bags, the other bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void UnionWith(
    OrderedBag<T> otherBag
)
Public Sub UnionWith ( _
    otherBag As OrderedBag(Of T) _
)
public:
void UnionWith(
    OrderedBag<T>^ otherBag
)

Parameters

otherBag
Type: Wintellect.PowerCollections..::..OrderedBag <(Of <(<' T >)>)>
Bag to union with.

Exceptions

Exception | Condition
InvalidOperationException | This bag and otherBag don't use the same method for comparing items.
ArgumentNullException | otherBag is null.

Remarks

The union of two bags is computed in time O(M + N log M), where M is the size of the larger bag, and N is the size of the smaller bag.

See Also

OrderedBag<(Of <(<'T>)>)> Class


OrderedBag(T) Properties

OrderedBag<(Of <(<'T>)>)> Properties

The OrderedBag<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare items in this bag.
Public property | Count | Returns the number of items in the bag.
Public property | Item | Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Comparer Property

OrderedBag<(Of <(<'T>)>)>..::..Comparer Property

Returns the IComparer<T> used to compare items in this bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IComparer<T> Comparer { get; }
Public ReadOnly Property Comparer As IComparer(Of T)
    Get
public:
property IComparer<T>^ Comparer {
    IComparer<T>^ get ();
}

Field Value

If the bag was created using a comparer, that comparer is returned. If the bag was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for T (Comparer<T>.Default) is returned.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Count Property

OrderedBag<(Of <(<'T>)>)>..::..Count Property

Returns the number of items in the bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the bag.

Remarks

The size of the bag is returned in constant time.

See Also

OrderedBag<(Of <(<'T>)>)> Class


Item Property

OrderedBag<(Of <(<'T>)>)>..::..Item Property

Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; }
Public ReadOnly Default Property Item ( _
    index As Integer _
) As T
    Get
public:
property T default[int^ index] {
    T get (int^ index);
}

Parameters

index
Type: Int32
The index to get the item by.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The indexer takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)> Class


OrderedBag(T).View Class

OrderedBag<(Of <(<'T>)>)>..::..View Class

The OrderedBag<T>.View class is used to look at a subset of the items inside an ordered bag. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class View : CollectionBase<[T]>
<SerializableAttribute> _
Public Class View _
    Inherits CollectionBase(Of [T])
[SerializableAttribute]
public ref class View : public CollectionBase<[T]^>

Remarks

Views are dynamic. If the underlying bag changes, the view changes in sync. If a change is made to the view, the underlying bag changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the items in a subset of the OrderedBag. For example:

C#
foreach(T item in bag.Range(from, to)) {
   // process item
}

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'[T]>)>)>
Wintellect.PowerCollections..::..OrderedBag<(Of <(<'T>)>)>..::..View

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Members


OrderedBag(T).View Members

OrderedBag<(Of <(<'T>)>)>..::..View Members

The OrderedBag<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag underlying this View. If the bag already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.
Public method | AsList | Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method | Clear | Removes all the items within this view from the underlying bag.
Public method | Contains | Determines if this view of the bag contains an item equal to item. The bag is not changed. If
Public method | GetEnumerator | Enumerate all the items in this view.
Public method | GetFirst | Returns the first item in this view: the item that would appear first if the view was enumerated.
Public method | GetLast | Returns the last item in the view: the item that would appear last if the view was enumerated.
Public method | IndexOf | Get the first index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | LastIndexOf | Get the last index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | Remove | Searches the underlying bag for an item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If the item is outside the range of this view, the bag is unchanged.
Public method | Reversed | Creates a new View that has the same items as this view, in the reversed order.

Properties

 | Name | Description
Public property | Count | Number of items in this view.
Public property | Item | Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


OrderedBag(T).View Methods

OrderedBag<(Of <(<'T>)>)>..::..View Methods

The OrderedBag<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the bag underlying this View. If the bag already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.
Public method | AsList | Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method | Clear | Removes all the items within this view from the underlying bag.
Public method | Contains | Determines if this view of the bag contains an item equal to item. The bag is not changed. If
Public method | GetEnumerator | Enumerate all the items in this view.
Public method | GetFirst | Returns the first item in this view: the item that would appear first if the view was enumerated.
Public method | GetLast | Returns the last item in the view: the item that would appear last if the view was enumerated.
Public method | IndexOf | Get the first index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | LastIndexOf | Get the last index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | Remove | Searches the underlying bag for an item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If the item is outside the range of this view, the bag is unchanged.
Public method | Reversed | Creates a new View that has the same items as this view, in the reversed order.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Add Method

View..::..Add Method

Adds a new item to the bag underlying this View. If the bag already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    T item
)
Public Sub Add ( _
    item As T _
)
public:
void Add(
    T item
)

Parameters

item
Type: T
The item to add.

Return Value

True if the bag already contained an item equal to item (which was replaced), false otherwise.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

Adding an item takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


AsList Method

View..::..AsList Method

Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IList<T> AsList()
Public Function AsList As IList(Of T)
public:
IList<T>^ AsList()

Return Value

A read-only IList<T> view onto this view.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Clear Method

View..::..Clear Method

Removes all the items within this view from the underlying bag.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Examples

The following removes all the items that start with "A" from an OrderedBag.
C#
bag.Range("A", "B").Clear();

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Contains Method

View..::..Contains Method

Determines if this view of the bag contains an item equal to item. The bag is not changed. If

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the bag contains item, and item is within the range of this view. False otherwise.

Remarks

Searching the bag for an item takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


GetEnumerator Method

View..::..GetEnumerator Method

Enumerate all the items in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> with the items in this view.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


GetFirst Method

View..::..GetFirst Method

Returns the first item in this view: the item that would appear first if the view was enumerated.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetFirst()
Public Function GetFirst As T
public:
T GetFirst()

Return Value

The first item in the view.

Exceptions

Exception | Condition
InvalidOperationException | The view has no items in it.

Remarks

GetFirst() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


GetLast Method

View..::..GetLast Method

Returns the last item in the view: the item that would appear last if the view was enumerated.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetLast()
Public Function GetLast As T
public:
T GetLast()

Return Value

The last item in the view.

Exceptions

Exception | Condition
InvalidOperationException | The view has no items in it.

Remarks

GetLast() takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


IndexOf Method

View..::..IndexOf Method

Get the first index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int IndexOf(
    T item
)
Public Function IndexOf ( _
    item As T _
) As Integer
public:
int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the first item in the view equal to item, or -1 if the item is not present in the view.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


LastIndexOf Method

View..::..LastIndexOf Method

Get the last index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int LastIndexOf(
    T item
)
Public Function LastIndexOf ( _
    item As T _
) As Integer
public:
int^ LastIndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the last item in the view equal to item, or -1 if the item is not present in the view.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Remove Method

View..::..Remove Method

Searches the underlying bag for an item equal to item, and if found, removes it from the bag. If not found, the bag is unchanged. If the item is outside the range of this view, the bag is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the bag, or was outside the range of this view.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the bag.

Removing an item from the bag takes time O(log N), where N is the number of items in the bag.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Reversed Method

View..::..Reversed Method

Creates a new View that has the same items as this view, in the reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedBag<(Of <(<'T>)>)>..::..View Reversed()
Public Function Reversed As OrderedBag<(Of <(<'T>)>)>..::..View
public:
OrderedBag<(Of <(<'T>)>)>..::..View^ Reversed()

Return Value

A new View that has the reversed order of this view, with the same upper and lower bounds.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


OrderedBag(T).View Properties

OrderedBag<(Of <(<'T>)>)>..::..View Properties

The OrderedBag<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Properties

 | Name | Description
Public property | Count | Number of items in this view.
Public property | Item | Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Count Property

View..::..Count Property

Number of items in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

Number of items that lie within the bounds the view.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


Item Property

View..::..Item Property

Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; }
Public ReadOnly Default Property Item ( _
    index As Integer _
) As T
    Get
public:
property T default[int^ index] {
    T get (int^ index);
}

Parameters

index
Type: Int32
The index to get the item by.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The indexer takes time O(log N), which N is the number of items in the set.

See Also

OrderedBag<(Of <(<'T>)>)>..::..View Class


OrderedDictionary(TKey, TValue) Class

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class

OrderedDictionary<TKey, TValue> is a collection that maps keys of type TKey to values of type TValue. The keys are maintained in a sorted order, and at most one value is permitted for each key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class OrderedDictionary<TKey, TValue> : DictionaryBase<TKey, TValue>

<SerializableAttribute> _
Public Class OrderedDictionary(Of TKey, TValue) _
    Inherits DictionaryBase(Of TKey, TValue)
[SerializableAttribute]
generic<typename TKey, typename TValue>
public ref class OrderedDictionary : public DictionaryBase<TKey, TValue>

Type Parameters

TKey
TValue

Remarks

The keys are compared in one of three ways. If TKey implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare elements. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.

OrderedDictionary is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) type, where N is the number of keys in the tree.

Dictionary is similar, but uses hashing instead of comparison, and does not maintain the keys in sorted order.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
Wintellect.PowerCollections..::..DictionaryBase <(Of <(<'TKey, TValue>)>)>
Wintellect.PowerCollections..::..OrderedDictionary<(Of <(<'TKey, TValue>)>)>

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Members
Wintellect.PowerCollections Namespace
Dictionary


OrderedDictionary(TKey, TValue) Members

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Members

The OrderedDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>()()()() | Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IComparer<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(Comparison<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>)) | Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>), IComparer<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>), Comparison<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.

Methods

 | Name | Description
Public method | Add | Adds a new key and value to the dictionary. If the dictionary already contains a key equal to the passed key, then an ArgumentException is thrown
Public method | AddMany | Adds multiple key-value pairs to a dictionary. If a key exists in both the current instance and dictionaryToAdd, then the value is updated with the value from keysAndValues> (no exception is thrown). Since IDictionary<TKey,TValue> inherits from IEnumerable<KeyValuePair<TKey,TValue>>, this method can be used to merge one dictionary into another.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | ContainsKey | Determines if this dictionary contains a key equal to key. The dictionary is not changed.
Public method | GetEnumerator | Returns an enumerator that enumerates all the entries in the dictionary. Each entry is returned as a KeyValuePair<TKey,TValue>. The entries are enumerated in the sorted order of the keys.
Public method | GetValueElseAdd | Finds a key in the dictionary. If the dictionary already contains a key equal to the passed key, then the existing value is returned via value. If the dictionary doesn't contain that key, then value is associated with that key.
Public method | Range | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove | Removes the key (and associated value) from the collection that is equal to the passed in key. If no key in the dictionary is equal to the passed key, false is returned and the dictionary is unchanged.
Public method | RemoveMany | Removes all the keys found in another collection (such as an array or List<TKey>). Each key in keyCollectionToRemove is removed from the dictionary. Keys that are not present are ignored.
Public method | Replace | Changes the value associated with a given key. If the dictionary does not contain a key equal to the passed key, then an ArgumentException is thrown.
Public method | Reversed | Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare keys in this dictionary.
Public property | Count | Returns the number of keys in the dictionary.
Public property | Item | Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedDictionary(TKey, TValue) Constructor

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor

Overload List

 | Name | Description
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>()()()() | Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IComparer<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(Comparison<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>)) | Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>), IComparer<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.
Public method | OrderedDictionary<(Of <(<'TKey, TValue>)>)>(IEnumerable<(Of <<'(KeyValuePair<(Of <<'(TKey, TValue>)>>)>)>>), Comparison<(Of <<'(TKey>)>>)) | Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary. A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Members


OrderedDictionary(TKey, TValue) Constructor

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor

Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary()
Public Sub New
public:
OrderedDictionary()

Exceptions

Exception | Condition
InvalidOperationException | TKey does not implement IComparable<TKey>.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Constructor (IComparer(TKey))

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor (IComparer<(Of <(<'TKey>)>)>)

Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary(
    IComparer<TKey> comparer
)
Public Sub New ( _
    comparer As IComparer(Of TKey) _
)
public:
OrderedDictionary(
    IComparer<TKey>^ comparer
)

Parameters

comparer
Type: IComparer <(Of <(<' TKey >)>)>
An instance of IComparer<TKey> that will be used to compare keys.

Remarks

The GetHashCode and Equals methods of the provided IComparer<TKey> will never be called, and need not be implemented.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Constructor (Comparison(TKey))

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Comparison<(Of <(<'TKey>)>)>)

Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary(
    Comparison<TKey> comparison
)
Public Sub New ( _
    comparison As Comparison(Of TKey) _
)
public:
OrderedDictionary(
    Comparison<TKey>^ comparison
)

Parameters

comparison
Type: Comparison <(Of <(<' TKey >)>)>
A delegate to a method that will be used to compare keys.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Constructor (IEnumerable(KeyValuePair(TKey, TValue)))

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor (IEnumerable<(Of <(<'KeyValuePair<(Of <(<'TKey, TValue>)>)>>)>)>)

Creates a new OrderedDictionary. The TKey must implemented IComparable<TKey> or IComparable. The CompareTo method of this interface will be used to compare keys in this dictionary.

A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>> keysAndValues
)
Public Sub New ( _
    keysAndValues As IEnumerable(Of KeyValuePair(Of TKey, TValue)) _
)
public:
OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>^>^ keysAndValues
)

Parameters

keysAndValues
Type: IEnumerable <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
A collection of keys and values whose contents are used to initialized the dictionary.

Exceptions

Exception | Condition
InvalidOperationException | TKey does not implement IComparable<TKey>.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Constructor (IEnumerable(KeyValuePair(TKey, TValue)), IComparer(TKey))

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor (IEnumerable<(Of <(<'KeyValuePair<(Of <(<'TKey, TValue>)>)>>)>)>, IComparer<(Of <(<'TKey>)>)>)

Creates a new OrderedDictionary. The Compare method of the passed comparison object will be used to compare keys in this dictionary.

A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>> keysAndValues,
    IComparer<TKey> comparer
)
Public Sub New ( _
    keysAndValues As IEnumerable(Of KeyValuePair(Of TKey, TValue)), _
    comparer As IComparer(Of TKey) _
)
public:
OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>^>^ keysAndValues,
    IComparer<TKey>^ comparer
)

Parameters

keysAndValues
Type: IEnumerable <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
A collection of keys and values whose contents are used to initialized the dictionary.
comparer
Type: IComparer <(Of <(<' TKey >)>)>
An instance of IComparer<TKey> that will be used to compare keys.

Remarks

The GetHashCode and Equals methods of the provided IComparer<TKey> will never be called, and need not be implemented.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Constructor (IEnumerable(KeyValuePair(TKey, TValue)), Comparison(TKey))

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Constructor (IEnumerable<(Of <(<'KeyValuePair<(Of <(<'TKey, TValue>)>)>>)>)>, Comparison<(Of <(<'TKey>)>)>)

Creates a new OrderedDictionary. The passed delegate will be used to compare keys in this dictionary.

A collection and keys and values (typically another dictionary) is used to initialized the contents of the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>> keysAndValues,
    Comparison<TKey> comparison
)
Public Sub New ( _
    keysAndValues As IEnumerable(Of KeyValuePair(Of TKey, TValue)), _
    comparison As Comparison(Of TKey) _
)
public:
OrderedDictionary(
    IEnumerable<KeyValuePair<TKey, TValue>^>^ keysAndValues,
    Comparison<TKey>^ comparison
)

Parameters

keysAndValues
Type: IEnumerable <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
A collection of keys and values whose contents are used to initialized the dictionary.
comparison
Type: Comparison <(Of <(<' TKey >)>)>
A delegate to a method that will be used to compare keys.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedDictionary(TKey, TValue) Methods

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Methods

The OrderedDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new key and value to the dictionary. If the dictionary already contains a key equal to the passed key, then an ArgumentException is thrown
Public method | AddMany | Adds multiple key-value pairs to a dictionary. If a key exists in both the current instance and dictionaryToAdd, then the value is updated with the value from keysAndValues> (no exception is thrown). Since IDictionary<TKey,TValue> inherits from IEnumerable<KeyValuePair<TKey,TValue>>, this method can be used to merge one dictionary into another.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | ContainsKey | Determines if this dictionary contains a key equal to key. The dictionary is not changed.
Public method | GetEnumerator | Returns an enumerator that enumerates all the entries in the dictionary. Each entry is returned as a KeyValuePair<TKey,TValue>. The entries are enumerated in the sorted order of the keys.
Public method | GetValueElseAdd | Finds a key in the dictionary. If the dictionary already contains a key equal to the passed key, then the existing value is returned via value. If the dictionary doesn't contain that key, then value is associated with that key.
Public method | Range | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove | Removes the key (and associated value) from the collection that is equal to the passed in key. If no key in the dictionary is equal to the passed key, false is returned and the dictionary is unchanged.
Public method | RemoveMany | Removes all the keys found in another collection (such as an array or List<TKey>). Each key in keyCollectionToRemove is removed from the dictionary. Keys that are not present are ignored.
Public method | Replace | Changes the value associated with a given key. If the dictionary does not contain a key equal to the passed key, then an ArgumentException is thrown.
Public method | Reversed | Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Add Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Add Method

Adds a new key and value to the dictionary. If the dictionary already contains a key equal to the passed key, then an ArgumentException is thrown

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    TKey key,
    TValue value
)
Public Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The new key. "null" is a valid key value.
value
Type: TValue
The new value to associated with that key.

Exceptions

Exception | Condition
ArgumentException | key is already present in the dictionary

Remarks

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

Adding an key and value takes time O(log N), where N is the number of keys in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


AddMany Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..AddMany Method

Adds multiple key-value pairs to a dictionary. If a key exists in both the current instance and dictionaryToAdd, then the value is updated with the value from keysAndValues> (no exception is thrown). Since IDictionary<TKey,TValue> inherits from IEnumerable<KeyValuePair<TKey,TValue>>, this method can be used to merge one dictionary into another.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddMany(
    IEnumerable<KeyValuePair<TKey, TValue>> keysAndValues
)
Public Sub AddMany ( _
    keysAndValues As IEnumerable(Of KeyValuePair(Of TKey, TValue)) _
)
public:
void AddMany(
    IEnumerable<KeyValuePair<TKey, TValue>^>^ keysAndValues
)

Parameters

keysAndValues
Type: IEnumerable <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
A collection of keys and values whose contents are added to the current dictionary.

Remarks

AddMany takes time O(M log (N+M)), where M is the size of keysAndValues>, and N is the size of this dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Clear Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Clear Method

Removes all keys and values from the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the dictionary takes a constant amount of time, regardless of the number of keys in it.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Clone Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Clone Method

Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<TKey, TValue> Clone()
Public Function Clone As OrderedDictionary(Of TKey, TValue)
public:
OrderedDictionary<TKey, TValue>^ Clone()

Return Value

The cloned dictionary.

Remarks

Cloning the dictionary takes time O(N), where N is the number of keys in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


CloneContents Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..CloneContents Method

Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<TKey, TValue> CloneContents()
Public Function CloneContents As OrderedDictionary(Of TKey, TValue)
public:
OrderedDictionary<TKey, TValue>^ CloneContents()

Return Value

The cloned dictionary.

Exceptions

Exception | Condition
InvalidOperationException | TKey or TValue is a reference type that does not implement ICloneable.

Remarks

If TKey or TValue is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the dictionary takes time O(N log N), where N is the number of keys in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


ContainsKey Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Determines if this dictionary contains a key equal to key. The dictionary is not changed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ContainsKey(
    TKey key
)
Public Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
The key to search for.

Return Value

True if the dictionary contains key. False if the dictionary does not contain key.

Remarks

Searching the dictionary for a key takes time O(log N), where N is the number of keys in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


GetEnumerator Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the entries in the dictionary. Each entry is returned as a KeyValuePair<TKey,TValue>. The entries are enumerated in the sorted order of the keys.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of TKey, TValue))
public:
IEnumerator<KeyValuePair<TKey, TValue>^>^ GetEnumerator()

Return Value

An enumerator for enumerating all the elements in the OrderedDictionary.

Remarks

Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the elements of the dictionary, which uses this method implicitly.

If an element is added to or deleted from the dictionary while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumeration all the entries in the dictionary takes time O(N log N), where N is the number of entries in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


GetValueElseAdd Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..GetValueElseAdd Method

Finds a key in the dictionary. If the dictionary already contains a key equal to the passed key, then the existing value is returned via value. If the dictionary doesn't contain that key, then value is associated with that key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool GetValueElseAdd(
    TKey key,
    ref TValue value
)
Public Function GetValueElseAdd ( _
    key As TKey, _
    ByRef value As TValue _
) As Boolean
public:
bool^ GetValueElseAdd(
    TKey key,
    TValue% value
)

Parameters

key
Type: TKey
The new key.
value
Type: TValue %
The new value to associated with that key, if the key isn't present. If the key was present, returns the exist value associated with that key.

Return Value

True if key was already present, false if key wasn't present (and a new value was added).

Remarks

between keys is determined by the comparison instance or delegate used to create the dictionary.

This method takes time O(log N), where N is the number of keys in the dictionary. If a value is added, It is more efficient than calling TryGetValue followed by Add, because the dictionary is not searched twice.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Range Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Range Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Range(
    TKey from,
    bool fromInclusive,
    TKey to,
    bool toInclusive
)
Public Function Range ( _
    from As TKey, _
    fromInclusive As Boolean, _
    to As TKey, _
    toInclusive As Boolean _
) As OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Range(
    TKey from,
    bool^ fromInclusive,
    TKey to,
    bool^ toInclusive
)

Parameters

from
Type: TKey
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--keys equal to the lower bound will be included in the range. If false, the lower bound is exclusive--keys equal to the lower bound will not be included in the range.
to
Type: TKey
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--keys equal to the upper bound will be included in the range. If false, the upper bound is exclusive--keys equal to the upper bound will not be included in the range.

Return Value

An OrderedDictionary.View of key-value pairs in the given range.

Remarks

If from is greater than or equal to to, the returned collection is empty.

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Range(from, true, to, false)) {
   // process pair
}

Calling Range does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


RangeFrom Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..RangeFrom Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View RangeFrom(
    TKey from,
    bool fromInclusive
)
Public Function RangeFrom ( _
    from As TKey, _
    fromInclusive As Boolean _
) As OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ RangeFrom(
    TKey from,
    bool^ fromInclusive
)

Parameters

from
Type: TKey
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--keys equal to the lower bound will be included in the range. If false, the lower bound is exclusive--keys equal to the lower bound will not be included in the range.

Return Value

An OrderedDictionary.View of key-value pairs in the given range.

Remarks

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.RangeFrom(from, true)) {
   // process pair
}

Calling RangeFrom does not copy of the data in the dictionary, and the operation takes constant time.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


RangeTo Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..RangeTo Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View RangeTo(
    TKey to,
    bool toInclusive
)
Public Function RangeTo ( _
    to As TKey, _
    toInclusive As Boolean _
) As OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ RangeTo(
    TKey to,
    bool^ toInclusive
)

Parameters

to
Type: TKey
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--keys equal to the upper bound will be included in the range. If false, the upper bound is exclusive--keys equal to the upper bound will not be included in the range.

Return Value

An OrderedDictionary.View of key-value pairs in the given range.

Remarks

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.RangeFrom(from, false)) {
   // process pair
}

Calling RangeTo does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Remove Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Removes the key (and associated value) from the collection that is equal to the passed in key. If no key in the dictionary is equal to the passed key, false is returned and the dictionary is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
The key to remove.

Return Value

True if the key was found and removed. False if the key was not found.

Remarks

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


RemoveMany Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..RemoveMany Method

Removes all the keys found in another collection (such as an array or List<TKey>). Each key in keyCollectionToRemove is removed from the dictionary. Keys that are not present are ignored.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<TKey> keyCollectionToRemove
)
Public Function RemoveMany ( _
    keyCollectionToRemove As IEnumerable(Of TKey) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<TKey>^ keyCollectionToRemove
)

Parameters

keyCollectionToRemove
Type: IEnumerable <(Of <(<' TKey >)>)>
A collection of keys to remove from the dictionary.

Return Value

The number of keys removed from the dictionary.

Remarks

RemoveMany takes time O(M log N), where M is the size of keyCollectionToRemove, and N is this size of this collection.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Replace Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Replace Method

Changes the value associated with a given key. If the dictionary does not contain a key equal to the passed key, then an ArgumentException is thrown.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Replace(
    TKey key,
    TValue value
)
Public Sub Replace ( _
    key As TKey, _
    value As TValue _
)
public:
void Replace(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The new key.
value
Type: TValue
The new value to associated with that key.

Exceptions

Exception | Condition
KeyNotFoundException | key is not present in the dictionary

Remarks

Unlike adding or removing an element, changing the value associated with a key can be performed while an enumeration (foreach) on the the dictionary is in progress.

Equality between keys is determined by the comparison instance or delegate used to create the dictionary.

Replace takes time O(log N), where N is the number of entries in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Reversed Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Reversed Method

Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Reversed()
Public Function Reversed As OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Reversed()

Return Value

An OrderedDictionary.View of key-value pairs in reverse order.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Reversed()) {
   // process pair
}

If an entry is added to or deleted from the dictionary while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Reverse does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


TryGetValue Method

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..TryGetValue Method

Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetValue(
    TKey key,
    out TValue value
)
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
public:
bool^ TryGetValue(
    TKey key,
    [OutAttribute] TValue% value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue %
Returns the value associated with key, if true was returned.

Return Value

True if the dictionary contains key. False if the dictionary does not contain key.

Remarks

TryGetValue takes time O(log N), where N is the number of entries in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedDictionary(TKey, TValue) Properties

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Properties

The OrderedDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare keys in this dictionary.
Public property | Count | Returns the number of keys in the dictionary.
Public property | Item | Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Comparer Property

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Comparer Property

Returns the IComparer<T> used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IComparer<TKey> Comparer { get; }
Public ReadOnly Property Comparer As IComparer(Of TKey)
    Get
public:
property IComparer<TKey>^ Comparer {
    IComparer<TKey>^ get ();
}

Field Value

If the dictionary was created using a comparer, that comparer is returned. If the dictionary was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for TKey (Comparer<TKey>.Default) is returned.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Count Property

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Count Property

Returns the number of keys in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of keys in the dictionary.

Remarks

The size of the dictionary is returned in constant time..

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


Item Property

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..Item Property

Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TValue this[
    TKey key
] { get; set; }
Public Default Property Item ( _
    key As TKey _
) As TValue
    Get
    Set
public:
property TValue default[TKey key] {
    TValue get (TKey key);
    void set (TKey key, TValue value);
}

Parameters

key
Type: TKey

Field Value

The value associated with the key

Exceptions

Exception | Condition
ArgumentException | A value is being retrieved, and the key is not present in the dictionary.
ArgumentNullException | key is null.

Remarks

The indexer takes time O(log N), where N is the number of entries in the dictionary.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedDictionary(TKey, TValue).View Class

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class

The OrderedDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class View : DictionaryBase<[TKey], [TValue]>
<SerializableAttribute> _
Public Class View _
    Inherits DictionaryBase(Of [TKey], [TValue])
[SerializableAttribute]
public ref class View : public DictionaryBase<[TKey]^, [TValue]^>

Remarks

Views are dynamic. If the underlying dictionary changes, the view changes in sync. If a change is made to the view, the underlying dictionary changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the keys and values in a subset of the OrderedDictionary. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Range(from, to)) {
   // process pair
}

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<' TKey, TValue >)>)>>)>)>
Wintellect.PowerCollections..::..DictionaryBase <(Of <(<'[TKey], [TValue]>)>)>
Wintellect.PowerCollections..::..OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Members


OrderedDictionary(TKey, TValue).View Members

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Members

The OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Clear | Removes all the keys and values within this view from the underlying OrderedDictionary.
Public method | ContainsKey | Tests if the key is present in the part of the dictionary being viewed.
Public method | GetEnumerator | Enumerate all the keys and values in this view.
Public method | Remove | Removes the key (and associated value) from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, the dictionary and view are unchanged.
Public method | Reversed | Creates a new View that has the same keys and values as this, in the reversed order.
Public method | TryGetValue | Determines if this view contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

Properties

 | Name | Description
Public property | Count | Number of keys in this view.
Public property | Item | Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary. When setting a value, the key must be within the range of keys being viewed.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedDictionary(TKey, TValue).View Methods

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Methods

The OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Clear | Removes all the keys and values within this view from the underlying OrderedDictionary.
Public method | ContainsKey | Tests if the key is present in the part of the dictionary being viewed.
Public method | GetEnumerator | Enumerate all the keys and values in this view.
Public method | Remove | Removes the key (and associated value) from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, the dictionary and view are unchanged.
Public method | Reversed | Creates a new View that has the same keys and values as this, in the reversed order.
Public method | TryGetValue | Determines if this view contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Clear Method

View..::..Clear Method

Removes all the keys and values within this view from the underlying OrderedDictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Examples

The following removes all the keys that start with "A" from an OrderedDictionary.
C#
dictionary.Range("A", "B").Clear();

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


ContainsKey Method

View..::..ContainsKey Method

Tests if the key is present in the part of the dictionary being viewed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ContainsKey(
    TKey key
)
Public Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to check for.

Return Value

True if the key is within this view.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


GetEnumerator Method

View..::..GetEnumerator Method

Enumerate all the keys and values in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<KeyValuePair<TKey, TValue>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of TKey, TValue))
public:
IEnumerator<KeyValuePair<TKey, TValue>^>^ GetEnumerator()

Return Value

An IEnumerator of KeyValuePairs with the keys and views in this view.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Remove Method

View..::..Remove Method

Removes the key (and associated value) from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, the dictionary and view are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
The key to remove.

Return Value

True if the key was found and removed. False if the key was not found.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Reversed Method

View..::..Reversed Method

Creates a new View that has the same keys and values as this, in the reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Reversed()
Public Function Reversed As OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Reversed()

Return Value

A new View that has the reversed order of this view.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


TryGetValue Method

View..::..TryGetValue Method

Determines if this view contains a key equal to key. If so, the value associated with that key is returned through the value parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetValue(
    TKey key,
    out TValue value
)
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
public:
bool^ TryGetValue(
    TKey key,
    [OutAttribute] TValue% value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue %
Returns the value associated with key, if true was returned.

Return Value

True if the key is within this view.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedDictionary(TKey, TValue).View Properties

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Properties

The OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Properties

 | Name | Description
Public property | Count | Number of keys in this view.
Public property | Item | Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary. When setting a value, the key must be within the range of keys being viewed.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Count Property

View..::..Count Property

Number of keys in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

Number of keys that lie within the bounds the view.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Item Property

View..::..Item Property

Gets or sets the value associated with a given key. When getting a value, if this key is not found in the collection, then an ArgumentException is thrown. When setting a value, the value replaces any existing value in the dictionary. When setting a value, the key must be within the range of keys being viewed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TValue this[
    TKey key
] { get; set; }
Public Default Property Item ( _
    key As TKey _
) As TValue
    Get
    Set
public:
property TValue default[TKey key] {
    TValue get (TKey key);
    void set (TKey key, TValue value);
}

Parameters

key
Type: TKey

Field Value

The value associated with the key.

Exceptions

Exception | Condition
ArgumentException | A value is being retrieved, and the key is not present in the dictionary, or a value is being set, and the key is outside the range of keys being viewed by this View.

See Also

OrderedDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedMultiDictionary(TKey, TValue) Class

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class

The OrderedMultiDictionary class that associates values with a key. Unlike an OrderedDictionary, each key can have multiple values associated with it. When indexing an OrderedMultidictionary, instead of a single value associated with a key, you retrieve an enumeration of values.

All of the key are stored in sorted order. Also, the values associated with a given key are kept in sorted order as well.

When constructed, you can chose to allow the same value to be associated with a key multiple times, or only one time.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class OrderedMultiDictionary<TKey, TValue> : MultiDictionaryBase<TKey, TValue>

<SerializableAttribute> _
Public Class OrderedMultiDictionary(Of TKey, TValue) _
    Inherits MultiDictionaryBase(Of TKey, TValue)
[SerializableAttribute]
generic<typename TKey, typename TValue>
public ref class OrderedMultiDictionary : public MultiDictionaryBase<TKey, TValue>

Type Parameters

TKey
The type of the keys.
TValue
The of values associated with the keys.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>>)>)>
Wintellect.PowerCollections..::..MultiDictionaryBase <(Of <(<'TKey, TValue>)>)>
Wintellect.PowerCollections..::..OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Members
Wintellect.PowerCollections Namespace
Wintellect.PowerCollections..::..MultiDictionary<(Of <(<'TKey, TValue>)>)>
Wintellect.PowerCollections..::..OrderedDictionary<(Of <(<'TKey, TValue>)>)>


OrderedMultiDictionary(TKey, TValue) Members

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Members

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean) | Create a new OrderedMultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, Comparison<(Of <<'(TKey>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, Comparison<(Of <<'(TKey>)>>), Comparison<(Of <<'(TValue>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IComparer<(Of <<'(TKey>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IComparer<(Of <<'(TKey>)>>), IComparer<(Of <<'(TValue>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Methods

 | Name | Description
Public method | Add | Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary. If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Checks to see if value is associated with key in the dictionary.
Public method | ContainsKey | Checks to see if the key is present in the dictionary and has at least one value associated with it.
Public method | Range | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.
Public method | Reversed | Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.

Properties

 | Name | Description
Public property | Count | Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.
Public property | KeyComparer | Returns the IComparer<T> used to compare keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | ValueComparer | Returns the IComparer<T> used to compare values in this dictionary.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedMultiDictionary(TKey, TValue) Constructor

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor

Overload List

 | Name | Description
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean) | Create a new OrderedMultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, Comparison<(Of <<'(TKey>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, Comparison<(Of <<'(TKey>)>>), Comparison<(Of <<'(TValue>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IComparer<(Of <<'(TKey>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.
Public method | OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>(Boolean, IComparer<(Of <<'(TKey>)>>), IComparer<(Of <<'(TValue>)>>)) | Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Members


OrderedMultiDictionary(TKey, TValue) Constructor (Boolean)

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean)

Create a new OrderedMultiDictionary. The default ordering of keys and values are used. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary(
    bool allowDuplicateValues
)
Public Sub New ( _
    allowDuplicateValues As Boolean _
)
public:
OrderedMultiDictionary(
    bool^ allowDuplicateValues
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?

Exceptions

Exception | Condition
InvalidOperationException | TKey or TValue does not implement either IComparable<T> or IComparable.

Remarks

The default ordering of keys and values will be used, as defined by TKey and TValue's implementation of IComparable<T> (or IComparable if IComparable<T> is not implemented). If a different ordering should be used, other constructors allow a custom Comparer or IComparer to be passed to changed the ordering.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedMultiDictionary(TKey, TValue) Constructor (Boolean, Comparison(TKey))

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, Comparison<(Of <(<'TKey>)>)>)

Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary(
    bool allowDuplicateValues,
    Comparison<TKey> keyComparison
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyComparison As Comparison(Of TKey) _
)
public:
OrderedMultiDictionary(
    bool^ allowDuplicateValues,
    Comparison<TKey>^ keyComparison
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyComparison
Type: Comparison <(Of <(<' TKey >)>)>
A delegate to a method that will be used to compare keys.

Exceptions

Exception | Condition
InvalidOperationException | TValue does not implement either IComparable<TValue> or IComparable.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedMultiDictionary(TKey, TValue) Constructor (Boolean, Comparison(TKey), Comparison(TValue))

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, Comparison<(Of <(<'TKey>)>)>, Comparison<(Of <(<'TValue>)>)>)

Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary(
    bool allowDuplicateValues,
    Comparison<TKey> keyComparison,
    Comparison<TValue> valueComparison
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyComparison As Comparison(Of TKey), _
    valueComparison As Comparison(Of TValue) _
)
public:
OrderedMultiDictionary(
    bool^ allowDuplicateValues,
    Comparison<TKey>^ keyComparison,
    Comparison<TValue>^ valueComparison
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyComparison
Type: Comparison <(Of <(<' TKey >)>)>
A delegate to a method that will be used to compare keys.
valueComparison
Type: Comparison <(Of <(<' TValue >)>)>
A delegate to a method that will be used to compare values.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedMultiDictionary(TKey, TValue) Constructor (Boolean, IComparer(TKey))

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, IComparer<(Of <(<'TKey>)>)>)

Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary(
    bool allowDuplicateValues,
    IComparer<TKey> keyComparer
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyComparer As IComparer(Of TKey) _
)
public:
OrderedMultiDictionary(
    bool^ allowDuplicateValues,
    IComparer<TKey>^ keyComparer
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyComparer
Type: IComparer <(Of <(<' TKey >)>)>
An IComparer<TKey> instance that will be used to compare keys.

Exceptions

Exception | Condition
InvalidOperationException | TValue does not implement either IComparable<TValue> or IComparable.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedMultiDictionary(TKey, TValue) Constructor (Boolean, IComparer(TKey), IComparer(TValue))

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Constructor (Boolean, IComparer<(Of <(<'TKey>)>)>, IComparer<(Of <(<'TValue>)>)>)

Create a new OrderedMultiDictionary. If duplicate values are allowed, multiple copies of the same value can be associated with the same key. For example, the key "foo" could have "a", "a", and "b" associated with it. If duplicate values are not allowed, only one copies of a given value can be associated with the same key, although different keys can have the same value. For example, the key "foo" could have "a" and "b" associated with it, which key "bar" has values "b" and "c" associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary(
    bool allowDuplicateValues,
    IComparer<TKey> keyComparer,
    IComparer<TValue> valueComparer
)
Public Sub New ( _
    allowDuplicateValues As Boolean, _
    keyComparer As IComparer(Of TKey), _
    valueComparer As IComparer(Of TValue) _
)
public:
OrderedMultiDictionary(
    bool^ allowDuplicateValues,
    IComparer<TKey>^ keyComparer,
    IComparer<TValue>^ valueComparer
)

Parameters

allowDuplicateValues
Type: Boolean
Can the same value be associated with a key multiple times?
keyComparer
Type: IComparer <(Of <(<' TKey >)>)>
An IComparer<TKey> instance that will be used to compare keys.
valueComparer
Type: IComparer <(Of <(<' TValue >)>)>
An IComparer<TValue> instance that will be used to compare values.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Overload


OrderedMultiDictionary(TKey, TValue) Methods

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Methods

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary. If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.
Public method | Clear | Removes all keys and values from the dictionary.
Public method | Clone | Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | CloneContents | Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.
Public method | Contains | Checks to see if value is associated with key in the dictionary.
Public method | ContainsKey | Checks to see if the key is present in the dictionary and has at least one value associated with it.
Public method | Range | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method | RangeFrom | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.
Public method | RangeTo | Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.
Public method | Reversed | Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Add Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Add Method

Adds a new value to be associated with a key. If duplicate values are permitted, this method always adds a new key-value pair to the dictionary.

If duplicate values are not permitted, and key already has a value equal to value associated with it, then that value is replaced with value, and the number of values associate with key is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    TKey key,
    TValue value
)
Public Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to associate with.
value
Type: TValue
The value to associated with key.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Clear Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Clear Method

Removes all keys and values from the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Clone Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Clone Method

Makes a shallow clone of this dictionary; i.e., if keys or values of the dictionary are reference types, then they are not cloned. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<TKey, TValue> Clone()
Public Function Clone As OrderedMultiDictionary(Of TKey, TValue)
public:
OrderedMultiDictionary<TKey, TValue>^ Clone()

Return Value

The cloned dictionary.

Remarks

Cloning the dictionary takes time O(N), where N is the number of key-value pairs in the dictionary.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


CloneContents Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..CloneContents Method

Makes a deep clone of this dictionary. A new dictionary is created with a clone of each entry of this dictionary, by calling ICloneable.Clone on each element. If TKey or TValue is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<TKey, TValue> CloneContents()
Public Function CloneContents As OrderedMultiDictionary(Of TKey, TValue)
public:
OrderedMultiDictionary<TKey, TValue>^ CloneContents()

Return Value

The cloned dictionary.

Exceptions

Exception | Condition
InvalidOperationException | TKey or TValue is a reference type that does not implement ICloneable.

Remarks

If TKey or TValue is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the dictionary takes time O(N log N), where N is the number of key-value pairs in the dictionary.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Contains Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Checks to see if value is associated with key in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    TKey key,
    TValue value
)
Public Function Contains ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Contains(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to check.
value
Type: TValue
The value to check.

Return Value

True if value is associated with key.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


ContainsKey Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Checks to see if the key is present in the dictionary and has at least one value associated with it.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ContainsKey(
    TKey key
)
Public Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
The key to check.

Return Value

True if key is present and has at least one value associated with it. Returns false otherwise.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Range Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Range Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than from and less than to are included. The keys are enumerated in sorted order. Keys equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Range(
    TKey from,
    bool fromInclusive,
    TKey to,
    bool toInclusive
)
Public Function Range ( _
    from As TKey, _
    fromInclusive As Boolean, _
    to As TKey, _
    toInclusive As Boolean _
) As OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Range(
    TKey from,
    bool^ fromInclusive,
    TKey to,
    bool^ toInclusive
)

Parameters

from
Type: TKey
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--keys equal to the lower bound will be included in the range. If false, the lower bound is exclusive--keys equal to the lower bound will not be included in the range.
to
Type: TKey
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--keys equal to the upper bound will be included in the range. If false, the upper bound is exclusive--keys equal to the upper bound will not be included in the range.

Return Value

An OrderedMultiDictionary.View of key-value pairs in the given range.

Remarks

If from is greater than or equal to to, the returned collection is empty.

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Range(from, true, to, false)) {
   // process pair
}

Calling Range does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


RangeFrom Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..RangeFrom Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only keys that are greater than (and optionally, equal to) from are included. The keys are enumerated in sorted order. Keys equal to from can be included or excluded depending on the fromInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View RangeFrom(
    TKey from,
    bool fromInclusive
)
Public Function RangeFrom ( _
    from As TKey, _
    fromInclusive As Boolean _
) As OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ RangeFrom(
    TKey from,
    bool^ fromInclusive
)

Parameters

from
Type: TKey
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--keys equal to the lower bound will be included in the range. If false, the lower bound is exclusive--keys equal to the lower bound will not be included in the range.

Return Value

An OrderedMultiDictionary.View of key-value pairs in the given range.

Remarks

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.RangeFrom(from, true)) {
   // process pair
}

Calling RangeFrom does not copy of the data in the dictionary, and the operation takes constant time.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


RangeTo Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..RangeTo Method

Returns a collection that can be used for enumerating some of the keys and values in the collection. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View RangeTo(
    TKey to,
    bool toInclusive
)
Public Function RangeTo ( _
    to As TKey, _
    toInclusive As Boolean _
) As OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ RangeTo(
    TKey to,
    bool^ toInclusive
)

Parameters

to
Type: TKey
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--keys equal to the upper bound will be included in the range. If false, the upper bound is exclusive--keys equal to the upper bound will not be included in the range.

Return Value

An OrderedMultiDictionary.View of key-value pairs in the given range.

Remarks

The sorted order of the keys is determined by the comparison instance or delegate used to create the dictionary.

Typically, this property is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.RangeFrom(from, false)) {
   // process pair
}

Calling RangeTo does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Remove Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Overload List

 | Name | Description
Public method | Remove(TKey, TValue) | Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.
Public method | Remove(TKey) | Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Members


Remove Method (TKey, TValue)

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey, TValue)

Removes a given value from the values associated with a key. If the last value is removed from a key, the key is removed also.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key,
    TValue value
)
Public Function Remove ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Remove(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
A key to remove a value from.
value
Type: TValue
The value to remove.

Return Value

True if value was associated with key (and was therefore removed). False if value was not associated with key.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Remove Method (TKey)

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Remove Method (TKey)

Removes a key and all associated values from the dictionary. If the key is not present in the dictionary, it is unchanged and false is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
The key to remove.

Return Value

True if the key was present and was removed. Returns false if the key was not present.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class
Remove Overload


Reversed Method

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Reversed Method

Returns a View collection that can be used for enumerating the keys and values in the collection in reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Reversed()
Public Function Reversed As OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Reversed()

Return Value

An OrderedDictionary.View of key-value pairs in reverse order.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Reversed()) {
   // process pair
}

If an entry is added to or deleted from the dictionary while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Reverse does not copy the data in the dictionary, and the operation takes constant time.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedMultiDictionary(TKey, TValue) Properties

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Properties

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.
Public property | KeyComparer | Returns the IComparer<T> used to compare keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | ValueComparer | Returns the IComparer<T> used to compare values in this dictionary.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


Count Property

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..Count Property

Gets the number of key-value pairs in the dictionary. Each value associated with a given key is counted. If duplicate values are permitted, each duplicate value is included in the count.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of key-value pairs in the dictionary.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


KeyComparer Property

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..KeyComparer Property

Returns the IComparer<T> used to compare keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IComparer<TKey> KeyComparer { get; }
Public ReadOnly Property KeyComparer As IComparer(Of TKey)
    Get
public:
property IComparer<TKey>^ KeyComparer {
    IComparer<TKey>^ get ();
}

Field Value

If the dictionary was created using a comparer, that comparer is returned. If the dictionary was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for TKey (Comparer<TKey>.Default) is returned.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


KeyValuePairs Property

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..KeyValuePairs Property

Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public ICollection<KeyValuePair<TKey, TValue>> KeyValuePairs { get; }
Public ReadOnly Property KeyValuePairs As ICollection(Of KeyValuePair(Of TKey, TValue))
    Get
public:
property ICollection<KeyValuePair<TKey, TValue>^>^ KeyValuePairs {
    ICollection<KeyValuePair<TKey, TValue>^>^ get ();
}

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


ValueComparer Property

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..ValueComparer Property

Returns the IComparer<T> used to compare values in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IComparer<TValue> ValueComparer { get; }
Public ReadOnly Property ValueComparer As IComparer(Of TValue)
    Get
public:
property IComparer<TValue>^ ValueComparer {
    IComparer<TValue>^ get ();
}

Field Value

If the dictionary was created using a comparer, that comparer is returned. If the dictionary was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for TValue (Comparer<TValue>.Default) is returned.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)> Class


OrderedMultiDictionary(TKey, TValue).View Class

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class

The OrderedMultiDictionary<TKey,TValue>.View class is used to look at a subset of the keys and values inside an ordered multi-dictionary. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class View : MultiDictionaryBase<[TKey], [TValue]>
<SerializableAttribute> _
Public Class View _
    Inherits MultiDictionaryBase(Of [TKey], [TValue])
[SerializableAttribute]
public ref class View : public MultiDictionaryBase<[TKey]^, [TValue]^>

Remarks

Views are dynamic. If the underlying dictionary changes, the view changes in sync. If a change is made to the view, the underlying dictionary changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the keys and values in a subset of the OrderedMultiDictionary. For example:

C#
foreach(KeyValuePair<TKey, TValue> pair in dictionary.Range(from, to)) {
   // process pair
}

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<' KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>>)>)>
Wintellect.PowerCollections..::..MultiDictionaryBase <(Of <(<'[TKey], [TValue]>)>)>
Wintellect.PowerCollections..::..OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Members


OrderedMultiDictionary(TKey, TValue).View Members

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Members

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds the given key-value pair to the underlying dictionary of this view. If key is not within the range of this view, an ArgumentException is thrown.
Public method | Clear | Removes all the keys and values within this view from the underlying OrderedMultiDictionary.
Public method | Contains | Tests if the key-value pair is present in the part of the dictionary being viewed.
Public method | ContainsKey | Tests if the key is present in the part of the dictionary being viewed.
Public method | Remove(TKey) | Removes the key (and associated value) from the underlying dictionary of this view. If no key in the view is equal to the passed key, the dictionary and view are unchanged.
Public method | Remove(TKey, TValue) | Removes the key and value from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, or has the given value associated with it, the dictionary and view are unchanged.
Public method | Reversed | Creates a new View that has the same keys and values as this, in the reversed order.

Properties

 | Name | Description
Public property | Count | Number of keys in this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedMultiDictionary(TKey, TValue).View Methods

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Methods

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds the given key-value pair to the underlying dictionary of this view. If key is not within the range of this view, an ArgumentException is thrown.
Public method | Clear | Removes all the keys and values within this view from the underlying OrderedMultiDictionary.
Public method | Contains | Tests if the key-value pair is present in the part of the dictionary being viewed.
Public method | ContainsKey | Tests if the key is present in the part of the dictionary being viewed.
Public method | Remove(TKey) | Removes the key (and associated value) from the underlying dictionary of this view. If no key in the view is equal to the passed key, the dictionary and view are unchanged.
Public method | Remove(TKey, TValue) | Removes the key and value from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, or has the given value associated with it, the dictionary and view are unchanged.
Public method | Reversed | Creates a new View that has the same keys and values as this, in the reversed order.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Add Method

View..::..Add Method

Adds the given key-value pair to the underlying dictionary of this view. If key is not within the range of this view, an ArgumentException is thrown.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Add(
    TKey key,
    TValue value
)
Public Sub Add ( _
    key As TKey, _
    value As TValue _
)
public:
void Add(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
value
Type: TValue

Exceptions

Exception | Condition
ArgumentException | key is not within the range of this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Clear Method

View..::..Clear Method

Removes all the keys and values within this view from the underlying OrderedMultiDictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Examples

The following removes all the keys that start with "A" from an OrderedMultiDictionary.
C#
dictionary.Range("A", "B").Clear();

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Contains Method

View..::..Contains Method

Tests if the key-value pair is present in the part of the dictionary being viewed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    TKey key,
    TValue value
)
Public Function Contains ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Contains(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
Key to check for.
value
Type: TValue
Value to check for.

Return Value

True if the key-value pair is within this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


ContainsKey Method

View..::..ContainsKey Method

Tests if the key is present in the part of the dictionary being viewed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool ContainsKey(
    TKey key
)
Public Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to check

Return Value

True if the key is within this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Remove Method

View..::..Remove Method

Overload List

 | Name | Description
Public method | Remove(TKey) | Removes the key (and associated value) from the underlying dictionary of this view. If no key in the view is equal to the passed key, the dictionary and view are unchanged.
Public method | Remove(TKey, TValue) | Removes the key and value from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, or has the given value associated with it, the dictionary and view are unchanged.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Members


Remove Method (TKey)

View..::..Remove Method (TKey)

Removes the key (and associated value) from the underlying dictionary of this view. If no key in the view is equal to the passed key, the dictionary and view are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key
)
Public Function Remove ( _
    key As TKey _
) As Boolean
public:
bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
The key to remove.

Return Value

True if the key was found and removed. False if the key was not found.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class
Remove Overload


Remove Method (TKey, TValue)

View..::..Remove Method (TKey, TValue)

Removes the key and value from the underlying dictionary of this view. that is equal to the passed in key. If no key in the view is equal to the passed key, or has the given value associated with it, the dictionary and view are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    TKey key,
    TValue value
)
Public Function Remove ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Remove(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to remove.
value
Type: TValue
The value to remove.

Return Value

True if the key-value pair was found and removed. False if the key-value pair was not found.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class
Remove Overload


Reversed Method

View..::..Reversed Method

Creates a new View that has the same keys and values as this, in the reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Reversed()
Public Function Reversed As OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View
public:
OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View^ Reversed()

Return Value

A new View that has the reversed order of this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedMultiDictionary(TKey, TValue).View Properties

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Properties

The OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View generic type exposes the following members.

Properties

 | Name | Description
Public property | Count | Number of keys in this view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


Count Property

View..::..Count Property

Number of keys in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

Number of keys that lie within the bounds the view.

See Also

OrderedMultiDictionary<(Of <(<'TKey, TValue>)>)>..::..View Class


OrderedSet(T) Class

OrderedSet<(Of <(<'T>)>)> Class

OrderedSet<T> is a collection that contains items of type T. The item are maintained in a sorted order, and duplicate items are not allowed. Each item has an index in the set: the smallest item has index 0, the next smallest item has index 1, and so forth.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class OrderedSet<T> : CollectionBase<T>

<SerializableAttribute> _
Public Class OrderedSet(Of T) _
    Inherits CollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class OrderedSet : public CollectionBase<T>

Type Parameters

T

Remarks

The items are compared in one of three ways. If T implements IComparable<TKey> or IComparable, then the CompareTo method of that interface will be used to compare items. Alternatively, a comparison function can be passed in either as a delegate, or as an instance of IComparer<TKey>.

OrderedSet is implemented as a balanced binary tree. Inserting, deleting, and looking up an an element all are done in log(N) type, where N is the number of keys in the tree.

Set<(Of <(<'T>)>)> is similar, but uses hashing instead of comparison, and does not maintain the items in sorted order.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..OrderedSet<(Of <(<'T>)>)>

See Also

OrderedSet<(Of <(<'T>)>)> Members
Wintellect.PowerCollections Namespace
Wintellect.PowerCollections..::..Set<(Of <(<'T>)>)>


OrderedSet(T) Members

OrderedSet<(Of <(<'T>)>)> Members

The OrderedSet<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | OrderedSet<(Of <(<'T>)>)>()()()() | Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(Comparison<(Of <<'(T>)>>)) | Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(IComparer<(Of <<'(T>)>>)) | Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection.

Methods

Name Description
Public method Add
Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.
Public method AddMany
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.
Public method AsList
Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method Clear
Removes all items from the set.
Public method Clone
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method CloneContents
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method Contains
Determines if this set contains an item equal to item. The set is not changed.
Public method Difference
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
Public method DifferenceWith
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.
Public method GetEnumerator
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
Public method GetFirst
Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set.
Public method GetLast
Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set.
Public method IndexOf
Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method Intersection
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
Public method IntersectionWith
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
Public method IsDisjointFrom
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
Public method IsEqualTo
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
Public method IsProperSubsetOf
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.
Public method IsProperSupersetOf
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.
Public method IsSubsetOf
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.
Public method IsSupersetOf
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet, and N is the size of the this set.
Public method Range
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method RangeFrom
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
Public method RangeTo
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method Remove
Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.
Public method RemoveFirst
Removes the first item in the set. This is also the smallest item in the set.
Public method RemoveLast
Removes the last item in the set. This is also the largest item in the set.
Public method RemoveMany
Removes all the items in collection from the set. Items not present in the set are ignored.
Public method Reversed
Returns a View collection that can be used for enumerating the items in the set in reversed order.
Public method SymmetricDifference
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
Public method SymmetricDifferenceWith
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
Public method TryGetItem

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.
Public method Union
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
Public method UnionWith
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare items in this set.
Public property | Count | Returns the number of items in the set.
Public property | Item | Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedSet<(Of <(<'T>)>)> Class


OrderedSet(T) Constructor

OrderedSet<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | OrderedSet<(Of <(<'T>)>)>()()()() | Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(Comparison<(Of <<'(T>)>>)) | Creates a new OrderedSet. The passed delegate will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(IComparer<(Of <<'(T>)>>)) | Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), Comparison<(Of <<'(T>)>>)) | Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection.
Public method | OrderedSet<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IComparer<(Of <<'(T>)>>)) | Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Members


OrderedSet(T) Constructor

OrderedSet<(Of <(<'T>)>)> Constructor

Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet()
Public Sub New
public:
OrderedSet()

Exceptions

Exception | Condition
InvalidOperationException | T does not implement IComparable<TKey>.

Remarks

Items that are null are permitted, and will be sorted before all other items.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Constructor (Comparison(T))

OrderedSet<(Of <(<'T>)>)> Constructor (Comparison<(Of <(<'T>)>)>)

Creates a new OrderedSet. The passed delegate will be used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet(
    Comparison<T> comparison
)
Public Sub New ( _
    comparison As Comparison(Of T) _
)
public:
OrderedSet(
    Comparison<T>^ comparison
)

Parameters

comparison
Type: Comparison <(Of <(<' T >)>)>
A delegate to a method that will be used to compare items.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Constructor (IComparer(T))

OrderedSet<(Of <(<'T>)>)> Constructor (IComparer<(Of <(<'T>)>)>)

Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet(
    IComparer<T> comparer
)
Public Sub New ( _
    comparer As IComparer(Of T) _
)
public:
OrderedSet(
    IComparer<T>^ comparer
)

Parameters

comparer
Type: IComparer <(Of <(<' T >)>)>
An instance of IComparer<T> that will be used to compare items.

Remarks

The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Constructor (IEnumerable(T))

OrderedSet<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Creates a new OrderedSet. The T must implement IComparable<T> or IComparable. The CompareTo method of this interface will be used to compare items in this set. The set is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
OrderedSet(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedSet.

Exceptions

Exception | Condition
InvalidOperationException | T does not implement IComparable<TKey>.

Remarks

Items that are null are permitted, and will be sorted before all other items.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Constructor (IEnumerable(T), Comparison(T))

OrderedSet<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, Comparison<(Of <(<'T>)>)>)

Creates a new OrderedSet. The passed delegate will be used to compare items in this set. The set is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet(
    IEnumerable<T> collection,
    Comparison<T> comparison
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    comparison As Comparison(Of T) _
)
public:
OrderedSet(
    IEnumerable<T>^ collection,
    Comparison<T>^ comparison
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedSet.
comparison
Type: Comparison <(Of <(<' T >)>)>
A delegate to a method that will be used to compare items.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Constructor (IEnumerable(T), IComparer(T))

OrderedSet<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, IComparer<(Of <(<'T>)>)>)

Creates a new OrderedSet. The Compare method of the passed comparison object will be used to compare items in this set. The set is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet(
    IEnumerable<T> collection,
    IComparer<T> comparer
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    comparer As IComparer(Of T) _
)
public:
OrderedSet(
    IEnumerable<T>^ collection,
    IComparer<T>^ comparer
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the OrderedSet.
comparer
Type: IComparer <(Of <(<' T >)>)>
An instance of IComparer<T> that will be used to compare items.

Remarks

The GetHashCode and Equals methods of the provided IComparer<T> will never be called, and need not be implemented.

See Also

OrderedSet<(Of <(<'T>)>)> Class
OrderedSet<(Of <(<'T>)>)> Overload


OrderedSet(T) Methods

OrderedSet<(Of <(<'T>)>)> Methods

The OrderedSet<(Of <(<'T>)>)> type exposes the following members.

Methods

Name Description
Public method Add
Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.
Public method AddMany
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.
Public method AsList
Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method Clear
Removes all items from the set.
Public method Clone
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method CloneContents
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method Contains
Determines if this set contains an item equal to item. The set is not changed.
Public method Difference
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
Public method DifferenceWith
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.
Public method GetEnumerator
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
Public method GetFirst
Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set.
Public method GetLast
Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set.
Public method IndexOf
Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method Intersection
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
Public method IntersectionWith
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
Public method IsDisjointFrom
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
Public method IsEqualTo
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
Public method IsProperSubsetOf
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.
Public method IsProperSupersetOf
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.
Public method IsSubsetOf
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.
Public method IsSupersetOf
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet, and N is the size of the this set.
Public method Range
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.
Public method RangeFrom
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.
Public method RangeTo
Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.
Public method Remove
Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.
Public method RemoveFirst
Removes the first item in the set. This is also the smallest item in the set.
Public method RemoveLast
Removes the last item in the set. This is also the largest item in the set.
Public method RemoveMany
Removes all the items in collection from the set. Items not present in the set are ignored.
Public method Reversed
Returns a View collection that can be used for enumerating the items in the set in reversed order.
Public method SymmetricDifference
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
Public method SymmetricDifferenceWith
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
Public method TryGetItem

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.
Public method Union
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
Public method UnionWith
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Add Method

OrderedSet<(Of <(<'T>)>)>..::..Add Method

Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Add(
    T item
)
Public Function Add ( _
    item As T _
) As Boolean
public:
bool^ Add(
    T item
)

Parameters

item
Type: T
The item to add to the set.

Return Value

True if the set already contained an item equal to item (which was replaced), false otherwise.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Adding an item takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


AddMany Method

OrderedSet<(Of <(<'T>)>)>..::..AddMany Method

Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddMany(
    IEnumerable<T> collection
)
Public Sub AddMany ( _
    collection As IEnumerable(Of T) _
)
public:
void AddMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to add to the set.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Adding the collection takes time O(M log N), where N is the number of items in the set, and M is the number of items in collection.

See Also

OrderedSet<(Of <(<'T>)>)> Class


AsList Method

OrderedSet<(Of <(<'T>)>)>..::..AsList Method

Get a read-only list view of the items in this ordered set. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IList<T> AsList()
Public Function AsList As IList(Of T)
public:
IList<T>^ AsList()

Return Value

A read-only IList<T> view onto this OrderedSet.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Clear Method

OrderedSet<(Of <(<'T>)>)>..::..Clear Method

Removes all items from the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the sets takes a constant amount of time, regardless of the number of items in it.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Clone Method

OrderedSet<(Of <(<'T>)>)>..::..Clone Method

Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> Clone()
Public Function Clone As OrderedSet(Of T)
public:
OrderedSet<T>^ Clone()

Return Value

The cloned set.

Remarks

Cloning the set takes time O(N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


CloneContents Method

OrderedSet<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> CloneContents()
Public Function CloneContents As OrderedSet(Of T)
public:
OrderedSet<T>^ CloneContents()

Return Value

The cloned set.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the set takes time O(N log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Contains Method

OrderedSet<(Of <(<'T>)>)>..::..Contains Method

Determines if this set contains an item equal to item. The set is not changed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the set contains item. False if the set does not contain item.

Remarks

Searching the set for an item takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Difference Method

OrderedSet<(Of <(<'T>)>)>..::..Difference Method

Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> Difference(
    OrderedSet<T> otherSet
)
Public Function Difference ( _
    otherSet As OrderedSet(Of T) _
) As OrderedSet(Of T)
public:
OrderedSet<T>^ Difference(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to difference with.

Return Value

The difference of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


DifferenceWith Method

OrderedSet<(Of <(<'T>)>)>..::..DifferenceWith Method

Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void DifferenceWith(
    OrderedSet<T> otherSet
)
Public Sub DifferenceWith ( _
    otherSet As OrderedSet(Of T) _
)
public:
void DifferenceWith(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to difference with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


GetEnumerator Method

OrderedSet<(Of <(<'T>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An enumerator for enumerating all the items in the OrderedSet.

Remarks

Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.

If an item is added to or deleted from the set while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumeration all the items in the set takes time O(N log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


GetFirst Method

OrderedSet<(Of <(<'T>)>)>..::..GetFirst Method

Returns the first item in the set: the item that would appear first if the set was enumerated. This is also the smallest item in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetFirst()
Public Function GetFirst As T
public:
T GetFirst()

Return Value

The first item in the set.

Exceptions

Exception | Condition
InvalidOperationException | The set is empty.

Remarks

GetFirst() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


GetLast Method

OrderedSet<(Of <(<'T>)>)>..::..GetLast Method

Returns the lastl item in the set: the item that would appear last if the set was enumerated. This is also the largest item in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetLast()
Public Function GetLast As T
public:
T GetLast()

Return Value

The lastl item in the set.

Exceptions

Exception | Condition
InvalidOperationException | The set is empty.

Remarks

GetLast() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IndexOf Method

OrderedSet<(Of <(<'T>)>)>..::..IndexOf Method

Get the index of the given item in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int IndexOf(
    T item
)
Public Function IndexOf ( _
    item As T _
) As Integer
public:
int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the item in the sorted set, or -1 if the item is not present in the set.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Intersection Method

OrderedSet<(Of <(<'T>)>)>..::..Intersection Method

Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> Intersection(
    OrderedSet<T> otherSet
)
Public Function Intersection ( _
    otherSet As OrderedSet(Of T) _
) As OrderedSet(Of T)
public:
OrderedSet<T>^ Intersection(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to intersection with.

Return Value

The intersection of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two sets is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IntersectionWith Method

OrderedSet<(Of <(<'T>)>)>..::..IntersectionWith Method

Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void IntersectionWith(
    OrderedSet<T> otherSet
)
Public Sub IntersectionWith ( _
    otherSet As OrderedSet(Of T) _
)
public:
void IntersectionWith(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to intersection with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two sets is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsDisjointFrom Method

OrderedSet<(Of <(<'T>)>)>..::..IsDisjointFrom Method

Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsDisjointFrom(
    OrderedSet<T> otherSet
)
Public Function IsDisjointFrom ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsDisjointFrom(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to check disjointness with.

Return Value

True if the two sets are disjoint, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The answer is computed in time O(N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsEqualTo Method

OrderedSet<(Of <(<'T>)>)>..::..IsEqualTo Method

Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsEqualTo(
    OrderedSet<T> otherSet
)
Public Function IsEqualTo ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsEqualTo(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to compare to

Return Value

True if this set is equal to otherSet, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsEqualTo is computed in time O(N), where N is the number of items in this set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsProperSubsetOf Method

OrderedSet<(Of <(<'T>)>)>..::..IsProperSubsetOf Method

Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSubsetOf(
    OrderedSet<T> otherSet
)
Public Function IsProperSubsetOf ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsProperSubsetOf(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a proper subset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsSubsetOf is computed in time O(N log M), where M is the size of the otherSet, and N is the size of the this set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsProperSupersetOf Method

OrderedSet<(Of <(<'T>)>)>..::..IsProperSupersetOf Method

Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSupersetOf(
    OrderedSet<T> otherSet
)
Public Function IsProperSupersetOf ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsProperSupersetOf(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
OrderedSet to compare to.

Return Value

True if this is a proper superset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsProperSupersetOf is computed in time O(M log N), where M is the number of unique items in otherSet.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsSubsetOf Method

OrderedSet<(Of <(<'T>)>)>..::..IsSubsetOf Method

Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSubsetOf(
    OrderedSet<T> otherSet
)
Public Function IsSubsetOf ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsSubsetOf(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a subset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsSubsetOf is computed in time O(N log M), where M is the size of the otherSet, and N is the size of the this set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


IsSupersetOf Method

OrderedSet<(Of <(<'T>)>)>..::..IsSupersetOf Method

Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M log N), where M is the size of the otherSet, and N is the size of the this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSupersetOf(
    OrderedSet<T> otherSet
)
Public Function IsSupersetOf ( _
    otherSet As OrderedSet(Of T) _
) As Boolean
public:
bool^ IsSupersetOf(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
OrderedSet to compare to.

Return Value

True if this is a superset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Range Method

OrderedSet<(Of <(<'T>)>)>..::..Range Method

Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than from and less than to are included. The items are enumerated in sorted order. Items equal to the end points of the range can be included or excluded depending on the fromInclusive and toInclusive parameters.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<(Of <(<'T>)>)>..::..View Range(
    T from,
    bool fromInclusive,
    T to,
    bool toInclusive
)
Public Function Range ( _
    from As T, _
    fromInclusive As Boolean, _
    to As T, _
    toInclusive As Boolean _
) As OrderedSet<(Of <(<'T>)>)>..::..View
public:
OrderedSet<(Of <(<'T>)>)>..::..View^ Range(
    T from,
    bool^ fromInclusive,
    T to,
    bool^ toInclusive
)

Parameters

from
Type: T
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--items equal to the lower bound will be included in the range. If false, the lower bound is exclusive--items equal to the lower bound will not be included in the range.
to
Type: T
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--items equal to the upper bound will be included in the range. If false, the upper bound is exclusive--items equal to the upper bound will not be included in the range.

Return Value

An OrderedSet.View of items in the given range.

Remarks

If from is greater than to, the returned collection is empty.

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in set.Range(from, true, to, false)) {
   // process item
}

If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Range does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedSet<(Of <(<'T>)>)> Class


RangeFrom Method

OrderedSet<(Of <(<'T>)>)>..::..RangeFrom Method

Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are greater than (and optionally, equal to) from are included. The items are enumerated in sorted order. Items equal to from can be included or excluded depending on the fromInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<(Of <(<'T>)>)>..::..View RangeFrom(
    T from,
    bool fromInclusive
)
Public Function RangeFrom ( _
    from As T, _
    fromInclusive As Boolean _
) As OrderedSet<(Of <(<'T>)>)>..::..View
public:
OrderedSet<(Of <(<'T>)>)>..::..View^ RangeFrom(
    T from,
    bool^ fromInclusive
)

Parameters

from
Type: T
The lower bound of the range.
fromInclusive
Type: Boolean
If true, the lower bound is inclusive--items equal to the lower bound will be included in the range. If false, the lower bound is exclusive--items equal to the lower bound will not be included in the range.

Return Value

An OrderedSet.View of items in the given range.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in set.RangeFrom(from, true)) {
   // process item
}

If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling RangeFrom does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedSet<(Of <(<'T>)>)> Class


RangeTo Method

OrderedSet<(Of <(<'T>)>)>..::..RangeTo Method

Returns a View collection that can be used for enumerating a range of the items in the set.. Only items that are less than (and optionally, equal to) to are included. The items are enumerated in sorted order. Items equal to to can be included or excluded depending on the toInclusive parameter.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<(Of <(<'T>)>)>..::..View RangeTo(
    T to,
    bool toInclusive
)
Public Function RangeTo ( _
    to As T, _
    toInclusive As Boolean _
) As OrderedSet<(Of <(<'T>)>)>..::..View
public:
OrderedSet<(Of <(<'T>)>)>..::..View^ RangeTo(
    T to,
    bool^ toInclusive
)

Parameters

to
Type: T
The upper bound of the range.
toInclusive
Type: Boolean
If true, the upper bound is inclusive--items equal to the upper bound will be included in the range. If false, the upper bound is exclusive--items equal to the upper bound will not be included in the range.

Return Value

An OrderedSet.View of items in the given range.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in set.RangeTo(to, false)) {
   // process item
}

If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling RangeTo does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Remove Method

OrderedSet<(Of <(<'T>)>)>..::..Remove Method

Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the set.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Removing an item from the set takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


RemoveFirst Method

OrderedSet<(Of <(<'T>)>)>..::..RemoveFirst Method

Removes the first item in the set. This is also the smallest item in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveFirst()
Public Function RemoveFirst As T
public:
T RemoveFirst()

Return Value

The item that was removed, which was the smallest item in the set.

Exceptions

Exception | Condition
InvalidOperationException | The set is empty.

Remarks

RemoveFirst() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


RemoveLast Method

OrderedSet<(Of <(<'T>)>)>..::..RemoveLast Method

Removes the last item in the set. This is also the largest item in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T RemoveLast()
Public Function RemoveLast As T
public:
T RemoveLast()

Return Value

The item that was removed, which was the largest item in the set.

Exceptions

Exception | Condition
InvalidOperationException | The set is empty.

Remarks

RemoveLast() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


RemoveMany Method

OrderedSet<(Of <(<'T>)>)>..::..RemoveMany Method

Removes all the items in collection from the set. Items not present in the set are ignored.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<T> collection
)
Public Function RemoveMany ( _
    collection As IEnumerable(Of T) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to remove from the set.

Return Value

The number of items removed from the set.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Removing the collection takes time O(M log N), where N is the number of items in the set, and M is the number of items in collection.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Reversed Method

OrderedSet<(Of <(<'T>)>)>..::..Reversed Method

Returns a View collection that can be used for enumerating the items in the set in reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<(Of <(<'T>)>)>..::..View Reversed()
Public Function Reversed As OrderedSet<(Of <(<'T>)>)>..::..View
public:
OrderedSet<(Of <(<'T>)>)>..::..View^ Reversed()

Return Value

An OrderedSet.View of items in reverse order.

Remarks

Typically, this method is used in conjunction with a foreach statement. For example:

C#
foreach(T item in set.Reversed()) {
   // process item
}

If an item is added to or deleted from the set while the View is being enumerated, then the enumeration will end with an InvalidOperationException.

Calling Reverse does not copy the data in the tree, and the operation takes constant time.

See Also

OrderedSet<(Of <(<'T>)>)> Class


SymmetricDifference Method

OrderedSet<(Of <(<'T>)>)>..::..SymmetricDifference Method

Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> SymmetricDifference(
    OrderedSet<T> otherSet
)
Public Function SymmetricDifference ( _
    otherSet As OrderedSet(Of T) _
) As OrderedSet(Of T)
public:
OrderedSet<T>^ SymmetricDifference(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to symmetric difference with.

Return Value

The symmetric difference of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The symmetric difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


SymmetricDifferenceWith Method

OrderedSet<(Of <(<'T>)>)>..::..SymmetricDifferenceWith Method

Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SymmetricDifferenceWith(
    OrderedSet<T> otherSet
)
Public Sub SymmetricDifferenceWith ( _
    otherSet As OrderedSet(Of T) _
)
public:
void SymmetricDifferenceWith(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to symmetric difference with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The symmetric difference of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


TryGetItem Method

OrderedSet<(Of <(<'T>)>)>..::..TryGetItem Method

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetItem(
    T item,
    out T foundItem
)
Public Function TryGetItem ( _
    item As T, _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
bool^ TryGetItem(
    T item,
    [OutAttribute] T% foundItem
)

Parameters

item
Type: T
The item to search for.
foundItem
Type: T %
Returns the item from the set that was equal to item.

Return Value

True if the set contains item. False if the set does not contain item.

Remarks

Searching the set for an item takes time O(log N), where N is the number of items in the set.

Examples

In the following example, the set contains strings which are compared in a case-insensitive manner.
C#
OrderedSet<string> set = new OrderedSet<string>(StringComparer.CurrentCultureIgnoreCase);
set.Add("HELLO");
string s;
bool b = set.TryGetItem("Hello", out s);   // b receives true, s receives "HELLO".

See Also

OrderedSet<(Of <(<'T>)>)> Class


Union Method

OrderedSet<(Of <(<'T>)>)>..::..Union Method

Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<T> Union(
    OrderedSet<T> otherSet
)
Public Function Union ( _
    otherSet As OrderedSet(Of T) _
) As OrderedSet(Of T)
public:
OrderedSet<T>^ Union(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to union with.

Return Value

The union of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.

The union of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


UnionWith Method

OrderedSet<(Of <(<'T>)>)>..::..UnionWith Method

Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void UnionWith(
    OrderedSet<T> otherSet
)
Public Sub UnionWith ( _
    otherSet As OrderedSet(Of T) _
)
public:
void UnionWith(
    OrderedSet<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..OrderedSet <(Of <(<' T >)>)>
Set to union with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.

The union of two sets is computed in time O(M + N log M), where M is the size of the larger set, and N is the size of the smaller set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


OrderedSet(T) Properties

OrderedSet<(Of <(<'T>)>)> Properties

The OrderedSet<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Comparer | Returns the IComparer<T> used to compare items in this set.
Public property | Count | Returns the number of items in the set.
Public property | Item | Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Comparer Property

OrderedSet<(Of <(<'T>)>)>..::..Comparer Property

Returns the IComparer<T> used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IComparer<T> Comparer { get; }
Public ReadOnly Property Comparer As IComparer(Of T)
    Get
public:
property IComparer<T>^ Comparer {
    IComparer<T>^ get ();
}

Field Value

If the set was created using a comparer, that comparer is returned. If the set was created using a comparison delegate, then a comparer equivalent to that delegate is returned. Otherwise the default comparer for T (Comparer<T>.Default) is returned.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Count Property

OrderedSet<(Of <(<'T>)>)>..::..Count Property

Returns the number of items in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the set.

Remarks

The size of the set is returned in constant time.

See Also

OrderedSet<(Of <(<'T>)>)> Class


Item Property

OrderedSet<(Of <(<'T>)>)>..::..Item Property

Get the item by its index in the sorted order. The smallest item has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; }
Public ReadOnly Default Property Item ( _
    index As Integer _
) As T
    Get
public:
property T default[int^ index] {
    T get (int^ index);
}

Parameters

index
Type: Int32
The index to get the item by.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The indexer takes time O(log N), which N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)> Class


OrderedSet(T).View Class

OrderedSet<(Of <(<'T>)>)>..::..View Class

The OrderedSet<T>.View class is used to look at a subset of the Items inside an ordered set. It is returned from the Range, RangeTo, RangeFrom, and Reversed methods.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class View : CollectionBase<[T]>
<SerializableAttribute> _
Public Class View _
    Inherits CollectionBase(Of [T])
[SerializableAttribute]
public ref class View : public CollectionBase<[T]^>

Remarks

Views are dynamic. If the underlying set changes, the view changes in sync. If a change is made to the view, the underlying set changes accordingly.

Typically, this class is used in conjunction with a foreach statement to enumerate the items in a subset of the OrderedSet. For example:

C#
foreach(T item in set.Range(from, to)) {
   // process item
}

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'[T]>)>)>
Wintellect.PowerCollections..::..OrderedSet<(Of <(<'T>)>)>..::..View

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Members


OrderedSet(T).View Members

OrderedSet<(Of <(<'T>)>)>..::..View Members

The OrderedSet<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the set underlying this View. If the set already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.
Public method | AsList | Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method | Clear | Removes all the items within this view from the underlying set.
Public method | Contains | Determines if this view of the set contains an item equal to item. The set is not changed. If
Public method | GetEnumerator | Enumerate all the items in this view.
Public method | GetFirst | Returns the first item in this view: the item that would appear first if the view was enumerated.
Public method | GetLast | Returns the last item in the view: the item that would appear last if the view was enumerated.
Public method | IndexOf | Get the index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | Remove | Searches the underlying set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged. If the item is outside the range of this view, the set is unchanged.
Public method | Reversed | Creates a new View that has the same items as this view, in the reversed order.

Properties

 | Name | Description
Public property | Count | Number of items in this view.
Public property | Item | Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


OrderedSet(T).View Methods

OrderedSet<(Of <(<'T>)>)>..::..View Methods

The OrderedSet<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Methods

 | Name | Description
Public method | Add | Adds a new item to the set underlying this View. If the set already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.
Public method | AsList | Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.
Public method | Clear | Removes all the items within this view from the underlying set.
Public method | Contains | Determines if this view of the set contains an item equal to item. The set is not changed. If
Public method | GetEnumerator | Enumerate all the items in this view.
Public method | GetFirst | Returns the first item in this view: the item that would appear first if the view was enumerated.
Public method | GetLast | Returns the last item in the view: the item that would appear last if the view was enumerated.
Public method | IndexOf | Get the index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.
Public method | Remove | Searches the underlying set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged. If the item is outside the range of this view, the set is unchanged.
Public method | Reversed | Creates a new View that has the same items as this view, in the reversed order.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Add Method

View..::..Add Method

Adds a new item to the set underlying this View. If the set already contains an item equal to item, that item is replaces with item. If item is outside the range of this view, an InvalidOperationException is thrown.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Add(
    T item
)
Public Function Add ( _
    item As T _
) As Boolean
public:
bool^ Add(
    T item
)

Parameters

item
Type: T
The item to add.

Return Value

True if the set already contained an item equal to item (which was replaced), false otherwise.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Adding an item takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


AsList Method

View..::..AsList Method

Get a read-only list view of the items in this view. The items in the list are in sorted order, with the smallest item at index 0. This view does not copy any data, and reflects any changes to the underlying OrderedSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IList<T> AsList()
Public Function AsList As IList(Of T)
public:
IList<T>^ AsList()

Return Value

A read-only IList<T> view onto this view.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Clear Method

View..::..Clear Method

Removes all the items within this view from the underlying set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Examples

The following removes all the items that start with "A" from an OrderedSet.
C#
set.Range("A", "B").Clear();

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Contains Method

View..::..Contains Method

Determines if this view of the set contains an item equal to item. The set is not changed. If

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the set contains item, and item is within the range of this view. False otherwise.

Remarks

Searching the set for an item takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


GetEnumerator Method

View..::..GetEnumerator Method

Enumerate all the items in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> with the items in this view.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


GetFirst Method

View..::..GetFirst Method

Returns the first item in this view: the item that would appear first if the view was enumerated.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetFirst()
Public Function GetFirst As T
public:
T GetFirst()

Return Value

The first item in the view.

Exceptions

Exception | Condition
InvalidOperationException | The view has no items in it.

Remarks

GetFirst() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


GetLast Method

View..::..GetLast Method

Returns the last item in the view: the item that would appear last if the view was enumerated.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T GetLast()
Public Function GetLast As T
public:
T GetLast()

Return Value

The last item in the view.

Exceptions

Exception | Condition
InvalidOperationException | The view has no items in it.

Remarks

GetLast() takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


IndexOf Method

View..::..IndexOf Method

Get the index of the given item in the view. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int IndexOf(
    T item
)
Public Function IndexOf ( _
    item As T _
) As Integer
public:
int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to get the index of.

Return Value

The index of the item in the view, or -1 if the item is not present in the view.

Remarks

Finding the index takes time O(log N), which N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Remove Method

View..::..Remove Method

Searches the underlying set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged. If the item is outside the range of this view, the set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the set, or was outside the range of this view.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Removing an item from the set takes time O(log N), where N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Reversed Method

View..::..Reversed Method

Creates a new View that has the same items as this view, in the reversed order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public OrderedSet<(Of <(<'T>)>)>..::..View Reversed()
Public Function Reversed As OrderedSet<(Of <(<'T>)>)>..::..View
public:
OrderedSet<(Of <(<'T>)>)>..::..View^ Reversed()

Return Value

A new View that has the reversed order of this view, with the same upper and lower bounds.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


OrderedSet(T).View Properties

OrderedSet<(Of <(<'T>)>)>..::..View Properties

The OrderedSet<(Of <(<'T>)>)>..::..View generic type exposes the following members.

Properties

 | Name | Description
Public property | Count | Number of items in this view.
Public property | Item | Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Count Property

View..::..Count Property

Number of items in this view.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

Number of items that lie within the bounds the view.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Item Property

View..::..Item Property

Get the item by its index in the sorted order. The smallest item in the view has index 0, the next smallest item has index 1, and the largest item has index Count-1.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public T this[
    int index
] { get; }
Public ReadOnly Default Property Item ( _
    index As Integer _
) As T
    Get
public:
property T default[int^ index] {
    T get (int^ index);
}

Parameters

index
Type: Int32
The index to get the item by.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

Remarks

The indexer takes time O(log N), which N is the number of items in the set.

See Also

OrderedSet<(Of <(<'T>)>)>..::..View Class


Pair(TFirst, TSecond) Structure

Pair<(Of <(<'TFirst, TSecond>)>)> Structure

Stores a pair of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public struct Pair<TFirst, TSecond> : IComparable,
    IComparable<Pair<TFirst, TSecond>>

<SerializableAttribute> _
Public Structure Pair(Of TFirst, TSecond) _
    Implements IComparable, IComparable(Of Pair(Of TFirst, TSecond))
[SerializableAttribute]
generic<typename TFirst, typename TSecond>
public value class Pair : IComparable, IComparable<Pair<TFirst, TSecond>^>

Type Parameters

TFirst
TSecond

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Members


Pair(TFirst, TSecond) Members

Pair<(Of <(<'TFirst, TSecond>)>)> Members

The Pair<(Of <(<'TFirst, TSecond>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | Pair<(Of <(<'TFirst, TSecond>)>)>(TFirst, TSecond) | Creates a new pair with given first and second elements.
Public method | Pair<(Of <(<'TFirst, TSecond>)>)>(KeyValuePair<(Of <<'(TFirst, TSecond>)>>)) | Creates a new pair using elements from a KeyValuePair structure. The First element gets the Key, and the Second elements gets the Value.

Methods

 | Name | Description
Public method | CompareTo | Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements. If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.
Public method | Equals(Object) | Determines if this pair is equal to another object. The pair is equal to another object if that object is a Pair, both element types are the same, and the first and second elements both compare equal using object.Equals.
Public method | Equals(Pair<(Of <<'(TFirst, TSecond>)>>)) | Determines if this pair is equal to another pair. The pair is equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Public method | GetHashCode | Returns a hash code for the pair, suitable for use in a hash-table or other hashed collection. Two pairs that compare equal (using Equals) will have the same hash code. The hash code for the pair is derived by combining the hash codes for each of the two elements of the pair.
Public method | ToKeyValuePair | Converts this Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Public method | ToString | Returns a string representation of the pair. The string representation of the pair is of the form: First: {0}, Second: {1} where {0} is the result of First.ToString(), and {1} is the result of Second.ToString() (or "null" if they are null.)

Operators

Name | Description
Equality | Determines if two pairs are equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Explicit Narrowing Explicit Explicit Explicit (Pair<(Of <<'(TFirst, TSecond>)>>) to KeyValuePair<(Of <<'(TFirst, TSecond>)>>)) | Converts a Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Explicit Narrowing Explicit Explicit Explicit (KeyValuePair<(Of <<'(TFirst, TSecond>)>>) to Pair<(Of <<'(TFirst, TSecond>)>>)) | Converts a KeyValuePair structure into a Pair. The First element gets the Key, and the Second element gets the Value.
Inequality | Determines if two pairs are not equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

Fields

 | Name | Description
Public field | First | The first element of the pair.
Public field | Second | The second element of the pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Pair(TFirst, TSecond) Constructor

Pair<(Of <(<'TFirst, TSecond>)>)> Constructor

Overload List

 | Name | Description
Public method | Pair<(Of <(<'TFirst, TSecond>)>)>(TFirst, TSecond) | Creates a new pair with given first and second elements.
Public method | Pair<(Of <(<'TFirst, TSecond>)>)>(KeyValuePair<(Of <<'(TFirst, TSecond>)>>)) | Creates a new pair using elements from a KeyValuePair structure. The First element gets the Key, and the Second elements gets the Value.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Pair<(Of <(<'TFirst, TSecond>)>)> Members


Pair(TFirst, TSecond) Constructor (TFirst, TSecond)

Pair<(Of <(<'TFirst, TSecond>)>)> Constructor (TFirst, TSecond)

Creates a new pair with given first and second elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Pair(
    TFirst first,
    TSecond second
)
Public Sub New ( _
    first As TFirst, _
    second As TSecond _
)
public:
Pair(
    TFirst first,
    TSecond second
)

Parameters

first
Type: TFirst
The first element of the pair.
second
Type: TSecond
The second element of the pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Pair<(Of <(<'TFirst, TSecond>)>)> Overload


Pair(TFirst, TSecond) Constructor (KeyValuePair(TFirst, TSecond))

Pair<(Of <(<'TFirst, TSecond>)>)> Constructor (KeyValuePair<(Of <(<'TFirst, TSecond>)>)>)

Creates a new pair using elements from a KeyValuePair structure. The First element gets the Key, and the Second elements gets the Value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Pair(
    KeyValuePair<TFirst, TSecond> keyAndValue
)
Public Sub New ( _
    keyAndValue As KeyValuePair(Of TFirst, TSecond) _
)
public:
Pair(
    KeyValuePair<TFirst, TSecond>^ keyAndValue
)

Parameters

keyAndValue
Type: KeyValuePair <(Of <(<' TFirst, TSecond >)>)>
The KeyValuePair to initialize the Pair with .

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Pair<(Of <(<'TFirst, TSecond>)>)> Overload


Pair(TFirst, TSecond) Fields

Pair<(Of <(<'TFirst, TSecond>)>)> Fields

The Pair<(Of <(<'TFirst, TSecond>)>)> type exposes the following members.

Fields

 | Name | Description
Public field | First | The first element of the pair.
Public field | Second | The second element of the pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


First Field

Pair<(Of <(<'TFirst, TSecond>)>)>..::..First Field

The first element of the pair.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TFirst First
Public First As TFirst
public:
TFirst First

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Second Field

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Second Field

The second element of the pair.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TSecond Second
Public Second As TSecond
public:
TSecond Second

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Pair(TFirst, TSecond) Methods

Pair<(Of <(<'TFirst, TSecond>)>)> Methods

The Pair<(Of <(<'TFirst, TSecond>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | CompareTo | Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements. If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.
Public method | Equals(Object) | Determines if this pair is equal to another object. The pair is equal to another object if that object is a Pair, both element types are the same, and the first and second elements both compare equal using object.Equals.
Public method | Equals(Pair<(Of <<'(TFirst, TSecond>)>>)) | Determines if this pair is equal to another pair. The pair is equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Public method | GetHashCode | Returns a hash code for the pair, suitable for use in a hash-table or other hashed collection. Two pairs that compare equal (using Equals) will have the same hash code. The hash code for the pair is derived by combining the hash codes for each of the two elements of the pair.
Public method | ToKeyValuePair | Converts this Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Public method | ToString | Returns a string representation of the pair. The string representation of the pair is of the form: First: {0}, Second: {1} where {0} is the result of First.ToString(), and {1} is the result of Second.ToString() (or "null" if they are null.)

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


CompareTo Method

Pair<(Of <(<'TFirst, TSecond>)>)>..::..CompareTo Method

Compares this pair to another pair of the some type. The pairs are compared by using the IComparable<T> or IComparable interface on TFirst and TSecond. The pairs are compared by their first elements first, if their first elements are equal, then they are compared by their second elements.

If either TFirst or TSecond does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the pairs cannot be compared.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int CompareTo(
    Pair<TFirst, TSecond> other
)
Public Function CompareTo ( _
    other As Pair(Of TFirst, TSecond) _
) As Integer
public:
int^ CompareTo(
    Pair<TFirst, TSecond>^ other
)

Parameters

other
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
The pair to compare to.

Return Value

An integer indicating how this pair compares to other. Less than zero indicates this pair is less than other. Zero indicate this pair is equals to other. Greater than zero indicates this pair is greater than other.

Exceptions

Exception | Condition
NotSupportedException | Either FirstSecond or TSecond is not comparable via the IComparable<T> or IComparable interfaces.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Equals Method

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Equals Method

Overload List

 | Name | Description
Public method | Equals(Object) | Determines if this pair is equal to another object. The pair is equal to another object if that object is a Pair, both element types are the same, and the first and second elements both compare equal using object.Equals.
Public method | Equals(Pair<(Of <<'(TFirst, TSecond>)>>)) | Determines if this pair is equal to another pair. The pair is equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Pair<(Of <(<'TFirst, TSecond>)>)> Members


Equals Method (Object)

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Equals Method (Object)

Determines if this pair is equal to another object. The pair is equal to another object if that object is a Pair, both element types are the same, and the first and second elements both compare equal using object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Equals(
    Object obj
)
Public Function Equals ( _
    obj As Object _
) As Boolean
public:
bool^ Equals(
    Object^ obj
)

Parameters

obj
Type: Object
Object to compare for equality.

Return Value

True if the objects are equal. False if the objects are not equal.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Equals Overload


Equals Method (Pair(TFirst, TSecond))

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Equals Method (Pair<(Of <(<'TFirst, TSecond>)>)>)

Determines if this pair is equal to another pair. The pair is equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Equals(
    Pair<TFirst, TSecond> other
)
Public Function Equals ( _
    other As Pair(Of TFirst, TSecond) _
) As Boolean
public:
bool^ Equals(
    Pair<TFirst, TSecond>^ other
)

Parameters

other
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
Pair to compare with for equality.

Return Value

True if the pairs are equal. False if the pairs are not equal.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Equals Overload


GetHashCode Method

Pair<(Of <(<'TFirst, TSecond>)>)>..::..GetHashCode Method

Returns a hash code for the pair, suitable for use in a hash-table or other hashed collection. Two pairs that compare equal (using Equals) will have the same hash code. The hash code for the pair is derived by combining the hash codes for each of the two elements of the pair.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int GetHashCode()
Public Function GetHashCode As Integer
public:
int^ GetHashCode()

Return Value

The hash code.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


ToKeyValuePair Method

Pair<(Of <(<'TFirst, TSecond>)>)>..::..ToKeyValuePair Method

Converts this Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public KeyValuePair<TFirst, TSecond> ToKeyValuePair()
Public Function ToKeyValuePair As KeyValuePair(Of TFirst, TSecond)
public:
KeyValuePair<TFirst, TSecond>^ ToKeyValuePair()

Return Value

The KeyValuePair created from this Pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


ToString Method

Pair<(Of <(<'TFirst, TSecond>)>)>..::..ToString Method

Returns a string representation of the pair. The string representation of the pair is of the form: First: {0}, Second: {1} where {0} is the result of First.ToString(), and {1} is the result of Second.ToString() (or "null" if they are null.)

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Pair(TFirst, TSecond) Operators and Type Conversions

Pair<(Of <(<'TFirst, TSecond>)>)> Operators and Type Conversions

The Pair<(Of <(<'TFirst, TSecond>)>)> type exposes the following members.

Operators

Name | Description
Equality | Determines if two pairs are equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.
Explicit Narrowing Explicit Explicit Explicit (Pair<(Of <<'(TFirst, TSecond>)>>) to KeyValuePair<(Of <<'(TFirst, TSecond>)>>)) | Converts a Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Explicit Narrowing Explicit Explicit Explicit (KeyValuePair<(Of <<'(TFirst, TSecond>)>>) to Pair<(Of <<'(TFirst, TSecond>)>>)) | Converts a KeyValuePair structure into a Pair. The First element gets the Key, and the Second element gets the Value.
Inequality | Determines if two pairs are not equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Equality Operator

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Equality Operator

Determines if two pairs are equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool operator ==(
    Pair<TFirst, TSecond> pair1,
    Pair<TFirst, TSecond> pair2
)
Public Shared Operator = ( _
    pair1 As Pair(Of TFirst, TSecond), _
    pair2 As Pair(Of TFirst, TSecond) _
) As Boolean
public:
static bool^ operator ==(
    Pair<TFirst, TSecond>^ pair1,
    Pair<TFirst, TSecond>^ pair2
)

Parameters

pair1
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
First pair to compare.
pair2
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
Second pair to compare.

Return Value

True if the pairs are equal. False if the pairs are not equal.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


Explicit Conversion Operators

Pair<(Of <(<'TFirst, TSecond>)>)> ExplicitNarrowingExplicitExplicitExplicit Conversion Operators

Overload List

Name | Description
Explicit Narrowing Explicit Explicit Explicit (Pair<(Of <<'(TFirst, TSecond>)>>) to KeyValuePair<(Of <<'(TFirst, TSecond>)>>)) | Converts a Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.
Explicit Narrowing Explicit Explicit Explicit (KeyValuePair<(Of <<'(TFirst, TSecond>)>>) to Pair<(Of <<'(TFirst, TSecond>)>>)) | Converts a KeyValuePair structure into a Pair. The First element gets the Key, and the Second element gets the Value.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
Pair<(Of <(<'TFirst, TSecond>)>)> Members


Explicit Conversion (Pair to KeyValuePair)

Pair<(Of <(<'TFirst, TSecond>)>)> ExplicitNarrowingExplicitExplicitExplicit Conversion (Pair to KeyValuePair)

Converts a Pair to a KeyValuePair. The Key part of the KeyValuePair gets the First element, and the Value part of the KeyValuePair gets the Second elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static explicit operator KeyValuePair<TFirst, TSecond> (
    Pair<TFirst, TSecond> pair
)
Public Shared Narrowing Operator CType ( _
    pair As Pair(Of TFirst, TSecond) _
) As KeyValuePair(Of TFirst, TSecond)
static explicit operator KeyValuePair<TFirst, TSecond>^ (
    Pair<TFirst, TSecond>^ pair
)

Parameters

pair
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
Pair to convert.

Return Value

The KeyValuePair created from pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
ExplicitNarrowingExplicitExplicitExplicit Overload


Explicit Conversion (KeyValuePair to Pair)

Pair<(Of <(<'TFirst, TSecond>)>)> ExplicitNarrowingExplicitExplicitExplicit Conversion (KeyValuePair to Pair)

Converts a KeyValuePair structure into a Pair. The First element gets the Key, and the Second element gets the Value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static explicit operator Pair<TFirst, TSecond> (
    KeyValuePair<TFirst, TSecond> keyAndValue
)
Public Shared Narrowing Operator CType ( _
    keyAndValue As KeyValuePair(Of TFirst, TSecond) _
) As Pair(Of TFirst, TSecond)
static explicit operator Pair<TFirst, TSecond>^ (
    KeyValuePair<TFirst, TSecond>^ keyAndValue
)

Parameters

keyAndValue
Type: KeyValuePair <(Of <(<' TFirst, TSecond >)>)>
The KeyValuePair to convert.

Return Value

The Pair created by converted the KeyValuePair into a Pair.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure
ExplicitNarrowingExplicitExplicitExplicit Overload


Inequality Operator

Pair<(Of <(<'TFirst, TSecond>)>)>..::..Inequality Operator

Determines if two pairs are not equal. Two pairs are equal if the first and second elements both compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool operator !=(
    Pair<TFirst, TSecond> pair1,
    Pair<TFirst, TSecond> pair2
)
Public Shared Operator <> ( _
    pair1 As Pair(Of TFirst, TSecond), _
    pair2 As Pair(Of TFirst, TSecond) _
) As Boolean
public:
static bool^ operator !=(
    Pair<TFirst, TSecond>^ pair1,
    Pair<TFirst, TSecond>^ pair2
)

Parameters

pair1
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
First pair to compare.
pair2
Type: Wintellect.PowerCollections..::..Pair <(Of <(<' TFirst, TSecond >)>)>
Second pair to compare.

Return Value

True if the pairs are not equal. False if the pairs are equal.

See Also

Pair<(Of <(<'TFirst, TSecond>)>)> Structure


ReadOnlyCollectionBase(T) Class

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class

ReadOnlyCollectionBase is a base class that can be used to more easily implement the generic ICollection<T> and non-generic ICollection interfaces for a read-only collection: a collection that does not allow adding or removing elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class ReadOnlyCollectionBase<T> : ICollection<T>,
    ICollection

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class ReadOnlyCollectionBase(Of T) _
    Implements ICollection(Of T), ICollection
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename T>
public ref class ReadOnlyCollectionBase abstract : ICollection<T>,
    ICollection

Type Parameters

T
The item type of the collection.

Remarks

To use ReadOnlyCollectionBase as a base class, the derived class must override the Count and GetEnumerator methods.

ICollection<T>.Contains need not be implemented by the derived class, but it should be strongly considered, because the ReadOnlyCollectionBase implementation may not be very efficient.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..ReadOnlyCollectionBase<(Of <(<'T>)>)>

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Members


ReadOnlyCollectionBase(T) Members

ReadOnlyCollectionBase<(Of <(<'T>)>)> Members

The ReadOnlyCollectionBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.
Public method | ConvertAll<(Of <<'(TOutput>)>>) | Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
Public method | CopyTo | Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
Public method | CountWhere | Counts the number of items in the collection that satisfy the condition defined by predicate.
Public method | Exists | Determines if the collection contains any item that satisfies the condition defined by predicate.
Public method | FindAll | Enumerates the items in the collection that satisfy the condition defined by predicate.
Public method | ForEach | Performs the specified action on each item in this collection.
Public method | GetEnumerator | Must be overridden to enumerate all the members of the collection.
Public method | ToArray | Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
Public method | ToString | Shows the string representation of the collection. The string representation contains a list of the items in the collection.
Public method | TrueForAll | Determines if all of the items in the collection satisfy the condition defined by predicate.

Properties

 | Name | Description
Public property | Count | Must be overridden to provide the number of items in the collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ReadOnlyCollectionBase(T) Methods

ReadOnlyCollectionBase<(Of <(<'T>)>)> Methods

The ReadOnlyCollectionBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.
Public method | ConvertAll<(Of <<'(TOutput>)>>) | Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.
Public method | CopyTo | Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.
Public method | CountWhere | Counts the number of items in the collection that satisfy the condition defined by predicate.
Public method | Exists | Determines if the collection contains any item that satisfies the condition defined by predicate.
Public method | FindAll | Enumerates the items in the collection that satisfy the condition defined by predicate.
Public method | ForEach | Performs the specified action on each item in this collection.
Public method | GetEnumerator | Must be overridden to enumerate all the members of the collection.
Public method | ToArray | Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.
Public method | ToString | Shows the string representation of the collection. The string representation contains a list of the items in the collection.
Public method | TrueForAll | Determines if all of the items in the collection satisfy the condition defined by predicate.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


Contains Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..Contains Method

Determines if the collection contains a particular item. This default implementation iterates all of the items in the collection via GetEnumerator, testing each item against item using IComparable<T>.Equals or Object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Contains(
    T item
)
Public Overridable Function Contains ( _
    item As T _
) As Boolean
public:
virtual bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to check for in the collection.

Return Value

True if the collection contains item, false otherwise.

Remarks

You should strongly consider overriding this method to provide a more efficient implementation.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ConvertAll(TOutput) Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..ConvertAll<(Of <(<'TOutput>)>)> Method

Convert this collection of items by applying a delegate to each item in the collection. The resulting enumeration contains the result of applying converter to each item in this collection, in order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IEnumerable<TOutput> ConvertAll<TOutput>(
    Converter<T, TOutput> converter
)

Public Overridable Function ConvertAll(Of TOutput) ( _
    converter As Converter(Of T, TOutput) _
) As IEnumerable(Of TOutput)
public:
generic<typename TOutput>
virtual IEnumerable<TOutput>^ ConvertAll(
    Converter<T, TOutput>^ converter
)

Type Parameters

TOutput
The type each item is being converted to.

Parameters

converter
Type: Converter <(Of <(<' T, TOutput>)>)>
A delegate to the method to call, passing each item in this collection.

Return Value

An IEnumerable<TOutput^gt; that enumerates the resulting collection from applying converter to each item in this collection in order.

Exceptions

Exception | Condition
ArgumentNullException | converter is null.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


CopyTo Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..CopyTo Method

Copies all the items in the collection into an array. Implemented by using the enumerator returned from GetEnumerator to get all the items and copy them to the provided array.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    T[] array,
    int arrayIndex
)
Public Overridable Sub CopyTo ( _
    array As T(), _
    arrayIndex As Integer _
)
public:
virtual void CopyTo(
    array<T>^ array,
    int^ arrayIndex
)

Parameters

array
Type: array< T >[]()[][]
Array to copy to.
arrayIndex
Type: Int32
Starting index in array to copy to.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


CountWhere Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..CountWhere Method

Counts the number of items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int CountWhere(
    Predicate<T> predicate
)
Public Overridable Function CountWhere ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ CountWhere(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

The number of items in the collection that satisfy predicate.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


Exists Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..Exists Method

Determines if the collection contains any item that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Exists(
    Predicate<T> predicate
)
Public Overridable Function Exists ( _
    predicate As Predicate(Of T) _
) As Boolean
public:
virtual bool^ Exists(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

True if the collection contains one or more items that satisfy the condition defined by predicate. False if the collection does not contain an item that satisfies predicate.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


FindAll Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..FindAll Method

Enumerates the items in the collection that satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerable<T> FindAll(
    Predicate<T> predicate
)
Public Function FindAll ( _
    predicate As Predicate(Of T) _
) As IEnumerable(Of T)
public:
IEnumerable<T>^ FindAll(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

An IEnumerable<T> that enumerates the items that satisfy the condition.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ForEach Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..ForEach Method

Performs the specified action on each item in this collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void ForEach(
    Action<T> action
)
Public Overridable Sub ForEach ( _
    action As Action(Of T) _
)
public:
virtual void ForEach(
    Action<T>^ action
)

Parameters

action
Type: Action <(Of <(<' T >)>)>
An Action delegate which is invoked for each item in this collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


GetEnumerator Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..GetEnumerator Method

Must be overridden to enumerate all the members of the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

A generic IEnumerator<T> that can be used to enumerate all the items in the collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ToArray Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..ToArray Method

Creates an array of the correct size, and copies all the items in the collection into the array, by calling CopyTo.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T[] ToArray()
Public Overridable Function ToArray As T()
public:
virtual array<T>^ ToArray()

Return Value

An array containing all the elements in the collection, in order.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ToString Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..ToString Method

Shows the string representation of the collection. The string representation contains a list of the items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


TrueForAll Method

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..TrueForAll Method

Determines if all of the items in the collection satisfy the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TrueForAll(
    Predicate<T> predicate
)
Public Overridable Function TrueForAll ( _
    predicate As Predicate(Of T) _
) As Boolean
public:
virtual bool^ TrueForAll(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.

Return Value

True if all of the items in the collection satisfy the condition defined by predicate, or if the collection is empty. False if one or more items in the collection do not satisfy predicate.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ReadOnlyCollectionBase(T) Properties

ReadOnlyCollectionBase<(Of <(<'T>)>)> Properties

The ReadOnlyCollectionBase<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Must be overridden to provide the number of items in the collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


Count Property

ReadOnlyCollectionBase<(Of <(<'T>)>)>..::..Count Property

Must be overridden to provide the number of items in the collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the collection.

See Also

ReadOnlyCollectionBase<(Of <(<'T>)>)> Class


ReadOnlyDictionaryBase(TKey, TValue) Class

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class

ReadOnlyDictionaryBase is a base class that can be used to more easily implement the generic IDictionary<T> and non-generic IDictionary interfaces.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class ReadOnlyDictionaryBase<TKey, TValue> : ReadOnlyCollectionBase<KeyValuePair<TKey, TValue>>

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class ReadOnlyDictionaryBase(Of TKey, TValue) _
    Inherits ReadOnlyCollectionBase(Of KeyValuePair(Of TKey, TValue))
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename TKey, typename TValue>
public ref class ReadOnlyDictionaryBase abstract : public ReadOnlyCollectionBase<KeyValuePair<TKey, TValue>^>

Type Parameters

TKey
The key type of the dictionary.
TValue
The value type of the dictionary.

Remarks

To use ReadOnlyDictionaryBase as a base class, the derived class must override Count, TryGetValue, GetEnumerator.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..ReadOnlyCollectionBase <(Of <(<' KeyValuePair <(Of <(<'TKey, TValue>)>)>>)>)>
Wintellect.PowerCollections..::..ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


ReadOnlyDictionaryBase(TKey, TValue) Members

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Members

The ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | Remove | Removes a key from the dictionary. Always throws an exception indicating that this method is not supported in a read-only dictionary.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden in the derived class.

Properties

 | Name | Description
Public property | Item | The indexer of the dictionary. The set accessor throws an NotSupportedException stating the dictionary is read-only.
Public property | Keys | Returns a collection of the keys in this dictionary.
Public property | Values | Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReadOnlyDictionaryBase(TKey, TValue) Methods

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Methods

The ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | Remove | Removes a key from the dictionary. Always throws an exception indicating that this method is not supported in a read-only dictionary.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.
Public method | TryGetValue | Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden in the derived class.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Contains Method

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Determines if a dictionary contains a given KeyValuePair. This implementation checks to see if the dictionary contains the given key, and if the value associated with the key is equal to (via object.Equals) the value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    KeyValuePair<TKey, TValue> item
)
Public Function Contains ( _
    item As KeyValuePair(Of TKey, TValue) _
) As Boolean
public:
bool^ Contains(
    KeyValuePair<TKey, TValue>^ item
)

Parameters

item
Type: KeyValuePair <(Of <(<' TKey, TValue >)>)>
A KeyValuePair containing the Key and Value to check for.

Return Value

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ContainsKey Method

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Determines whether a given key is found in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool ContainsKey(
    TKey key
)
Public Overridable Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
virtual bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to look for in the dictionary.

Return Value

True if the key is present in the dictionary.

Remarks

The default implementation simply calls TryGetValue and returns what it returns.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Remove Method

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Remove Method

Removes a key from the dictionary. Always throws an exception indicating that this method is not supported in a read-only dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool Remove(
    TKey key
)
Public Overridable Function Remove ( _
    key As TKey _
) As Boolean
public:
virtual bool^ Remove(
    TKey key
)

Parameters

key
Type: TKey
Key to remove from the dictionary.

Return Value

True if the key was found, false otherwise.

Exceptions

Exception | Condition
NotSupportedException | Always thrown.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ToString Method

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ToString Method

Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the dictionary.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


TryGetValue Method

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..TryGetValue Method

Determines if this dictionary contains a key equal to key. If so, the value associated with that key is returned through the value parameter. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetValue(
    TKey key,
    out TValue value
)
Public Function TryGetValue ( _
    key As TKey, _
    <OutAttribute> ByRef value As TValue _
) As Boolean
public:
bool^ TryGetValue(
    TKey key,
    [OutAttribute] TValue% value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue %
Returns the value associated with key, if true was returned.

Return Value

True if the dictionary contains key. False if the dictionary does not contain key.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReadOnlyDictionaryBase(TKey, TValue) Properties

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Properties

The ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Item | The indexer of the dictionary. The set accessor throws an NotSupportedException stating the dictionary is read-only.
Public property | Keys | Returns a collection of the keys in this dictionary.
Public property | Values | Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Item Property

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Item Property

The indexer of the dictionary. The set accessor throws an NotSupportedException stating the dictionary is read-only.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual TValue this[
    TKey key
] { get; set; }
Public Overridable Default Property Item ( _
    key As TKey _
) As TValue
    Get
    Set
public:
virtual property TValue default[TKey key] {
    TValue get (TKey key);
    void set (TKey key, TValue value);
}

Parameters

key
Type: TKey
Key to find in the dictionary.

Return Value

The value associated with the key.

Exceptions

Exception | Condition
NotSupportedException | Always thrown from the set accessor, indicating that the dictionary is read only.
KeyNotFoundException | Thrown from the get accessor if the key was not found.

Remarks

The get accessor is implemented by calling TryGetValue.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Keys Property

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Keys Property

Returns a collection of the keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TKey> Keys { get; }
Public Overridable ReadOnly Property Keys As ICollection(Of TKey)
    Get
public:
virtual property ICollection<TKey>^ Keys {
    ICollection<TKey>^ get ();
}

Field Value

A read-only collection of the keys in this dictionary.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Values Property

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Values Property

Returns a collection of the values in this dictionary. The ordering of values in this collection is the same as that in the Keys collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> Values { get; }
Public Overridable ReadOnly Property Values As ICollection(Of TValue)
    Get
public:
virtual property ICollection<TValue>^ Values {
    ICollection<TValue>^ get ();
}

Field Value

A read-only collection of the values in this dictionary.

See Also

ReadOnlyDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReadOnlyListBase(T) Class

ReadOnlyListBase<(Of <(<'T>)>)> Class

ReadOnlyListBase is an abstract class that can be used as a base class for a read-only collection that needs to implement the generic IList<T> and non-generic IList collections. The derived class needs to override the Count property and the get part of the indexer. The implementation of all the other methods in IList<T> and IList are handled by ListBase.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public abstract class ReadOnlyListBase<T> : ReadOnlyCollectionBase<T>

<SerializableAttribute> _
Public MustInherit Class ReadOnlyListBase(Of T) _
    Inherits ReadOnlyCollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class ReadOnlyListBase abstract : public ReadOnlyCollectionBase<T>

Type Parameters

T

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..ReadOnlyCollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..ReadOnlyListBase<(Of <(<'T>)>)>

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Members


ReadOnlyListBase(T) Members

ReadOnlyListBase<(Of <(<'T>)>)> Members

The ReadOnlyListBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.
Public method | CopyTo(array<T>[]()[][]) | Copies all the items in the list, in order, to array, starting at index 0.
Public method | CopyTo(array<T>[]()[][], Int32) | Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method | CopyTo(Int32, array<T>[]()[][], Int32, Int32) | Copies a range of elements from the list to array, starting at arrayIndex.
Public method | Find | Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method | FindIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLast | Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method | FindLastIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | GetEnumerator | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.
Public method | IndexOf(T) | Finds the index of the first item in the list that is equal to item.
Public method | IndexOf(T, Int32) | Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method | IndexOf(T, Int32, Int32) | Finds the index of the first item, in the range of count items starting from index, that is equal to item.
Public method | LastIndexOf(T) | Finds the index of the last item in the list that is equal to item.
Public method | LastIndexOf(T, Int32) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method | LastIndexOf(T, Int32, Int32) | Finds the index of the last item, in the range of count items ending at index, that is equal to item.
Public method | Range | Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items.
Public method | TryFind | Finds the first item in the list that satisfies the condition defined by predicate.
Public method | TryFindLast | Finds the last item in the list that satisfies the condition defined by predicate.

Properties

 | Name | Description
Public property | Count | The property must be overridden by the derived class to return the number of items in the list.
Public property | Item | The get part of the indexer must be overridden by the derived class to get values of the list at a particular index.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


ReadOnlyListBase(T) Methods

ReadOnlyListBase<(Of <(<'T>)>)> Methods

The ReadOnlyListBase<(Of <(<'T>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains | Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.
Public method | CopyTo(array<T>[]()[][]) | Copies all the items in the list, in order, to array, starting at index 0.
Public method | CopyTo(array<T>[]()[][], Int32) | Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method | CopyTo(Int32, array<T>[]()[][], Int32, Int32) | Copies a range of elements from the list to array, starting at arrayIndex.
Public method | Find | Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method | FindIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLast | Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.
Public method | FindLastIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | GetEnumerator | Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.
Public method | IndexOf(T) | Finds the index of the first item in the list that is equal to item.
Public method | IndexOf(T, Int32) | Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method | IndexOf(T, Int32, Int32) | Finds the index of the first item, in the range of count items starting from index, that is equal to item.
Public method | LastIndexOf(T) | Finds the index of the last item in the list that is equal to item.
Public method | LastIndexOf(T, Int32) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method | LastIndexOf(T, Int32, Int32) | Finds the index of the last item, in the range of count items ending at index, that is equal to item.
Public method | Range | Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items.
Public method | TryFind | Finds the first item in the list that satisfies the condition defined by predicate.
Public method | TryFindLast | Finds the last item in the list that satisfies the condition defined by predicate.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


Contains Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..Contains Method

Determines if the list contains any item that compares equal to item. The implementation simply checks whether IndexOf(item) returns a non-negative value.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the list contains an item that compares equal to item.

Remarks

Equality in the list is determined by the default sense of equality for T. If T implements IComparable<T>, the Equals method of that interface is used to determine equality. Otherwise, Object.Equals is used to determine equality.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


CopyTo Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..CopyTo Method

Overload List

 | Name | Description
Public method | CopyTo(array<T>[]()[][]) | Copies all the items in the list, in order, to array, starting at index 0.
Public method | CopyTo(array<T>[]()[][], Int32) | Copies all the items in the list, in order, to array, starting at arrayIndex.
Public method | CopyTo(Int32, array<T>[]()[][], Int32, Int32) | Copies a range of elements from the list to array, starting at arrayIndex.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
ReadOnlyListBase<(Of <(<'T>)>)> Members


CopyTo Method (T[])

ReadOnlyListBase<(Of <(<'T>)>)>..::..CopyTo Method (array<T>[]()[][])

Copies all the items in the list, in order, to array, starting at index 0.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    T[] array
)
Public Overridable Sub CopyTo ( _
    array As T() _
)
public:
virtual void CopyTo(
    array<T>^ array
)

Parameters

array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
CopyTo Overload


CopyTo Method (T[], Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..CopyTo Method (array<T>[]()[][], Int32)

Copies all the items in the list, in order, to array, starting at arrayIndex.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void CopyTo(
    T[] array,
    int arrayIndex
)
Public Sub CopyTo ( _
    array As T(), _
    arrayIndex As Integer _
)
public:
void CopyTo(
    array<T>^ array,
    int^ arrayIndex
)

Parameters

array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex.
arrayIndex
Type: Int32
The starting index in array to copy to.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
CopyTo Overload


CopyTo Method (Int32, T[], Int32, Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..CopyTo Method (Int32, array<T>[]()[][], Int32, Int32)

Copies a range of elements from the list to array, starting at arrayIndex.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual void CopyTo(
    int index,
    T[] array,
    int arrayIndex,
    int count
)
Public Overridable Sub CopyTo ( _
    index As Integer, _
    array As T(), _
    arrayIndex As Integer, _
    count As Integer _
)
public:
virtual void CopyTo(
    int^ index,
    array<T>^ array,
    int^ arrayIndex,
    int^ count
)

Parameters

index
Type: Int32
The starting index in the source list of the range to copy.
array
Type: array< T >[]()[][]
The array to copy to. This array must have a size that is greater than or equal to Count + arrayIndex.
arrayIndex
Type: Int32
The starting index in array to copy to.
count
Type: Int32
The number of items to copy.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
CopyTo Overload


Find Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..Find Method

Finds the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T Find(
    Predicate<T> predicate
)
Public Overridable Function Find ( _
    predicate As Predicate(Of T) _
) As T
public:
virtual T Find(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The first item that satisfies the condition predicate. If no item satisfies that condition, the default value for T is returned.

Remarks

If the default value for T (null or all-zero) matches the condition defined by predicate, and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFind(Predicate<(Of <<'(T>)>>), T%).

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
Wintellect.PowerCollections Namespace
ReadOnlyListBase<(Of <(<'T>)>)>..::..TryFind(Predicate<(Of <<'(T>)>>), T%)


FindIndex Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindIndex Method

Overload List

 | Name | Description
Public method | FindIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
ReadOnlyListBase<(Of <(<'T>)>)> Members


FindIndex Method (Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindIndex Method (Predicate<(Of <(<'T>)>)>)

Finds the index of the first item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindIndex Method (Int32, Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindIndex Method (Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the first item, in the range of items extending from index to the end, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    int index,
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    index As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    int^ index,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The starting index of the range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindIndex Method (Int32, Int32, Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindIndex Method (Int32, Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the first item, in the range of count items starting from index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindIndex(
    int index,
    int count,
    Predicate<T> predicate
)
Public Overridable Function FindIndex ( _
    index As Integer, _
    count As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindIndex(
    int^ index,
    int^ count,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The starting index of the range to check.
count
Type: Int32
The number of items in range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the first item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindIndex Overload


FindLast Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindLast Method

Finds the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, than the default value for T (null or all-zero) is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T FindLast(
    Predicate<T> predicate
)
Public Overridable Function FindLast ( _
    predicate As Predicate(Of T) _
) As T
public:
virtual T FindLast(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The last item that satisfies the condition predicate. If no item satisfies that condition, the default value for T is returned.

Remarks

If the default value for T (null or all-zero) matches the condition defined by predicate, and the list might contain the default value, then it is impossible to distinguish the different between finding the default value and not finding any item. To distinguish these cases, use TryFindLast(Predicate<(Of <<'(T>)>>), T%).

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
Wintellect.PowerCollections Namespace
ReadOnlyListBase<(Of <(<'T>)>)>..::..TryFindLast(Predicate<(Of <<'(T>)>>), T%)


FindLastIndex Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindLastIndex Method

Overload List

 | Name | Description
Public method | FindLastIndex(Predicate<(Of <<'(T>)>>)) | Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.
Public method | FindLastIndex(Int32, Int32, Predicate<(Of <<'(T>)>>)) | Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
ReadOnlyListBase<(Of <(<'T>)>)> Members


FindLastIndex Method (Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Predicate<(Of <(<'T>)>)>)

Finds the index of the last item in the list that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    Predicate<T>^ predicate
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


FindLastIndex Method (Int32, Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the last item, in the range of items extending from the beginning of the list to index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    int index,
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    index As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    int^ index,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The ending index of the range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


FindLastIndex Method (Int32, Int32, Predicate(T))

ReadOnlyListBase<(Of <(<'T>)>)>..::..FindLastIndex Method (Int32, Int32, Predicate<(Of <(<'T>)>)>)

Finds the index of the last item, in the range of count items ending at index, that satisfies the condition defined by predicate. If no item matches the condition, -1 is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int FindLastIndex(
    int index,
    int count,
    Predicate<T> predicate
)
Public Overridable Function FindLastIndex ( _
    index As Integer, _
    count As Integer, _
    predicate As Predicate(Of T) _
) As Integer
public:
virtual int^ FindLastIndex(
    int^ index,
    int^ count,
    Predicate<T>^ predicate
)

Parameters

index
Type: Int32
The ending index of the range to check.
count
Type: Int32
The number of items in range to check.
predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defined the condition to check for.

Return Value

The index of the last item in the given range that satisfies the condition predicate. If no item satisfies that condition, -1 is returned.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
FindLastIndex Overload


GetEnumerator Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..GetEnumerator Method

Enumerates all of the items in the list, in order. The item at index 0 is enumerated first, then the item at index 1, and so on.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An IEnumerator<T> that enumerates all the items in the list.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


IndexOf Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..IndexOf Method

Overload List

 | Name | Description
Public method | IndexOf(T) | Finds the index of the first item in the list that is equal to item.
Public method | IndexOf(T, Int32) | Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.
Public method | IndexOf(T, Int32, Int32) | Finds the index of the first item, in the range of count items starting from index, that is equal to item.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
ReadOnlyListBase<(Of <(<'T>)>)> Members


IndexOf Method (T)

ReadOnlyListBase<(Of <(<'T>)>)>..::..IndexOf Method (T)

Finds the index of the first item in the list that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item
)
Public Overridable Function IndexOf ( _
    item As T _
) As Integer
public:
virtual int^ IndexOf(
    T item
)

Parameters

item
Type: T
The item to search fror.

Return Value

The index of the first item in the list that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
IndexOf Overload


IndexOf Method (T, Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..IndexOf Method (T, Int32)

Finds the index of the first item, in the range of items extending from index to the end, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item,
    int index
)
Public Overridable Function IndexOf ( _
    item As T, _
    index As Integer _
) As Integer
public:
virtual int^ IndexOf(
    T item,
    int^ index
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The starting index of the range to check.

Return Value

The index of the first item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
IndexOf Overload


IndexOf Method (T, Int32, Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..IndexOf Method (T, Int32, Int32)

Finds the index of the first item, in the range of count items starting from index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int IndexOf(
    T item,
    int index,
    int count
)
Public Overridable Function IndexOf ( _
    item As T, _
    index As Integer, _
    count As Integer _
) As Integer
public:
virtual int^ IndexOf(
    T item,
    int^ index,
    int^ count
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The starting index of the range to check.
count
Type: Int32
The number of items in range to check.

Return Value

The index of the first item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
IndexOf Overload


LastIndexOf Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..LastIndexOf Method

Overload List

 | Name | Description
Public method | LastIndexOf(T) | Finds the index of the last item in the list that is equal to item.
Public method | LastIndexOf(T, Int32) | Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.
Public method | LastIndexOf(T, Int32, Int32) | Finds the index of the last item, in the range of count items ending at index, that is equal to item.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
ReadOnlyListBase<(Of <(<'T>)>)> Members


LastIndexOf Method (T)

ReadOnlyListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T)

Finds the index of the last item in the list that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item
)
Public Overridable Function LastIndexOf ( _
    item As T _
) As Integer
public:
virtual int^ LastIndexOf(
    T item
)

Parameters

item
Type: T
The item to search fror.

Return Value

The index of the last item in the list that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


LastIndexOf Method (T, Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T, Int32)

Finds the index of the last item, in the range of items extending from the beginning of the list to index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item,
    int index
)
Public Overridable Function LastIndexOf ( _
    item As T, _
    index As Integer _
) As Integer
public:
virtual int^ LastIndexOf(
    T item,
    int^ index
)

Parameters

item
Type: T
The item to search fror.
index
Type: Int32
The ending index of the range to check.

Return Value

The index of the last item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


LastIndexOf Method (T, Int32, Int32)

ReadOnlyListBase<(Of <(<'T>)>)>..::..LastIndexOf Method (T, Int32, Int32)

Finds the index of the last item, in the range of count items ending at index, that is equal to item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual int LastIndexOf(
    T item,
    int index,
    int count
)
Public Overridable Function LastIndexOf ( _
    item As T, _
    index As Integer, _
    count As Integer _
) As Integer
public:
virtual int^ LastIndexOf(
    T item,
    int^ index,
    int^ count
)

Parameters

item
Type: T
The item to search for.
index
Type: Int32
The ending index of the range to check.
count
Type: Int32
The number of items in range to check.

Return Value

The index of the last item in the given range that that is equal to item. If no item is equal to item, -1 is returned.

Remarks

The default implementation of equality for type T is used in the search. This is the equality defined by IComparable<T> or object.Equals.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class
LastIndexOf Overload


Range Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..Range Method

Returns a view onto a sub-range of this list. Items are not copied; the returned IList<T> is simply a different view onto the same underlying items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual IList<T> Range(
    int start,
    int count
)
Public Overridable Function Range ( _
    start As Integer, _
    count As Integer _
) As IList(Of T)
public:
virtual IList<T>^ Range(
    int^ start,
    int^ count
)

Parameters

start
Type: Int32
The starting index of the view.
count
Type: Int32
The number of items in the view.

Return Value

A list that is a view onto the given sub-part of this list.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | start or count is negative.
ArgumentOutOfRangeException | start + count is greater than the size of the list.

Remarks

This method can be used to apply an algorithm to a portion of a list. For example:

C#
Algorithms.Reverse(deque.Range(3, 6))
 will return the reverse opf the 6 items beginning at index 3.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


TryFind Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..TryFind Method

Finds the first item in the list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TryFind(
    Predicate<T> predicate,
    out T foundItem
)
Public Overridable Function TryFind ( _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
virtual bool^ TryFind(
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.
foundItem
Type: T %
If true is returned, this parameter receives the first item in the list that satifies the condition defined by predicate.

Return Value

True if an item that satisfies the condition predicate was found. False if no item in the list satisfies that condition.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


TryFindLast Method

ReadOnlyListBase<(Of <(<'T>)>)>..::..TryFindLast Method

Finds the last item in the list that satisfies the condition defined by predicate.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool TryFindLast(
    Predicate<T> predicate,
    out T foundItem
)
Public Overridable Function TryFindLast ( _
    predicate As Predicate(Of T), _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
virtual bool^ TryFindLast(
    Predicate<T>^ predicate,
    [OutAttribute] T% foundItem
)

Parameters

predicate
Type: Predicate <(Of <(<' T >)>)>
A delegate that defines the condition to check for.
foundItem
Type: T %
If true is returned, this parameter receives the last item in the list that satifies the condition defined by predicate.

Return Value

True if an item that satisfies the condition predicate was found. False if no item in the list satisfies that condition.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


ReadOnlyListBase(T) Properties

ReadOnlyListBase<(Of <(<'T>)>)> Properties

The ReadOnlyListBase<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | The property must be overridden by the derived class to return the number of items in the list.
Public property | Item | The get part of the indexer must be overridden by the derived class to get values of the list at a particular index.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


Count Property

ReadOnlyListBase<(Of <(<'T>)>)>..::..Count Property

The property must be overridden by the derived class to return the number of items in the list.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the list.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


Item Property

ReadOnlyListBase<(Of <(<'T>)>)>..::..Item Property

The get part of the indexer must be overridden by the derived class to get values of the list at a particular index.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual T this[
    int index
] { get; set; }
Public Overridable Default Property Item ( _
    index As Integer _
) As T
    Get
    Set
public:
virtual property T default[int^ index] {
    T get (int^ index);
    void set (int^ index, T value);
}

Parameters

index
Type: Int32
The index in the list to get or set an item at. The first item in the list has index 0, and the last has index Count-1.

Return Value

The item at the given index.

Exceptions

Exception | Condition
ArgumentOutOfRangeException | index is less than zero or greater than or equal to Count.

See Also

ReadOnlyListBase<(Of <(<'T>)>)> Class


ReadOnlyMultiDictionaryBase(TKey, TValue) Class

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class

MultiDictionaryBase is a base class that can be used to more easily implement a class that associates multiple values to a single key. The class implements the generic IDictionary<TKey, ICollection<TValue>> interface. The resulting collection is read-only -- items cannot be added or removed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
[DebuggerDisplayAttribute]
public abstract class ReadOnlyMultiDictionaryBase<TKey, TValue> : ReadOnlyCollectionBase<KeyValuePair<TKey, ICollection<TValue>>>

<SerializableAttribute> _
<DebuggerDisplayAttribute> _
Public MustInherit Class ReadOnlyMultiDictionaryBase(Of TKey, TValue) _
    Inherits ReadOnlyCollectionBase(Of KeyValuePair(Of TKey, ICollection(Of TValue)))
[SerializableAttribute]
[DebuggerDisplayAttribute]
generic<typename TKey, typename TValue>
public ref class ReadOnlyMultiDictionaryBase abstract : public ReadOnlyCollectionBase<KeyValuePair<TKey, ICollection<TValue>^>^>

Type Parameters

TKey
The key type of the dictionary.
TValue
The value type of the dictionary.

Remarks

To use ReadOnlyMultiDictionaryBase as a base class, the derived class must override Count, Contains(TKey,TValue), EnumerateKeys, and TryEnumerateValuesForKey .

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..ReadOnlyCollectionBase <(Of <(<' KeyValuePair <(Of <(<'TKey, ICollection <(Of <(<'TValue>)>)>>)>)>>)>)>
Wintellect.PowerCollections..::..ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


ReadOnlyMultiDictionaryBase(TKey, TValue) Members

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members

The ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | GetEnumerator | Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Properties

 | Name | Description
Public property | Count | Gets the number of keys in the dictionary. This property must be overridden in the derived class.
Public property | Item | Returns a collection of all of the values in the dictionary associated with key. If the key is not present in the dictionary, an ICollection with no values is returned. The returned ICollection is read-only.
Public property | Keys | Gets a read-only collection all the keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | Values | Gets a read-only collection of all the values in the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReadOnlyMultiDictionaryBase(TKey, TValue) Methods

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Methods

The ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..
Public method | ContainsKey | Determines whether a given key is found in the dictionary.
Public method | GetEnumerator | Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.
Public method | ToString | Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Contains Method

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method

Overload List

 | Name | Description
Public method | Contains(TKey, TValue) | Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.
Public method | Contains(KeyValuePair<(Of <<'(TKey, ICollection<(Of <<'(TValue>)>>)>)>>)) | Determines if this dictionary contains the given key and all of the values associated with that key..

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Members


Contains Method (TKey, TValue)

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method (TKey, TValue)

Determines if this dictionary contains a key-value pair equal to key and value. The dictionary is not changed. This method must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    TKey key,
    TValue value
)
Public Function Contains ( _
    key As TKey, _
    value As TValue _
) As Boolean
public:
bool^ Contains(
    TKey key,
    TValue value
)

Parameters

key
Type: TKey
The key to search for.
value
Type: TValue
The value to search for.

Return Value

True if the dictionary has associated value with key.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Contains Overload


Contains Method (KeyValuePair(TKey, ICollection(TValue)))

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Contains Method (KeyValuePair<(Of <(<'TKey, ICollection<(Of <(<'TValue>)>)>>)>)>)

Determines if this dictionary contains the given key and all of the values associated with that key..

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    KeyValuePair<TKey, ICollection<TValue>> pair
)
Public Function Contains ( _
    pair As KeyValuePair(Of TKey, ICollection(Of TValue)) _
) As Boolean
public:
bool^ Contains(
    KeyValuePair<TKey, ICollection<TValue>^>^ pair
)

Parameters

pair
Type: KeyValuePair <(Of <(<' TKey, ICollection <(Of <(<' TValue >)>)>>)>)>
A key and collection of values to search for.

Return Value

True if the dictionary has associated all of the values in pair.Value with pair.Key.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class
Contains Overload


ContainsKey Method

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ContainsKey Method

Determines whether a given key is found in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual bool ContainsKey(
    TKey key
)
Public Overridable Function ContainsKey ( _
    key As TKey _
) As Boolean
public:
virtual bool^ ContainsKey(
    TKey key
)

Parameters

key
Type: TKey
Key to look for in the dictionary.

Return Value

True if the key is present in the dictionary.

Remarks

The default implementation simply calls TryGetValue. It may be appropriate to override this method to provide a more efficient implementation.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


GetEnumerator Method

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..GetEnumerator Method

Enumerate all the keys in the dictionary, and for each key, the collection of values for that key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<KeyValuePair<TKey, ICollection<TValue>>> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of KeyValuePair(Of TKey, ICollection(Of TValue)))
public:
IEnumerator<KeyValuePair<TKey, ICollection<TValue>^>^>^ GetEnumerator()

Return Value

An enumerator to enumerate all the key, ICollection<value> pairs in the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ToString Method

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..ToString Method

Shows the string representation of the dictionary. The string representation contains a list of the mappings in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


ReadOnlyMultiDictionaryBase(TKey, TValue) Properties

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Properties

The ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Count | Gets the number of keys in the dictionary. This property must be overridden in the derived class.
Public property | Item | Returns a collection of all of the values in the dictionary associated with key. If the key is not present in the dictionary, an ICollection with no values is returned. The returned ICollection is read-only.
Public property | Keys | Gets a read-only collection all the keys in this dictionary.
Public property | KeyValuePairs | Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.
Public property | Values | Gets a read-only collection of all the values in the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Count Property

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Count Property

Gets the number of keys in the dictionary. This property must be overridden in the derived class.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Item Property

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Item Property

Returns a collection of all of the values in the dictionary associated with key. If the key is not present in the dictionary, an ICollection with no values is returned. The returned ICollection is read-only.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> this[
    TKey key
] { get; }
Public Overridable ReadOnly Default Property Item ( _
    key As TKey _
) As ICollection(Of TValue)
    Get
public:
virtual property ICollection<TValue>^ default[TKey key] {
    ICollection<TValue>^ get (TKey key);
}

Parameters

key
Type: TKey
The key to get the values associated with.

Field Value

An ICollection<TValue> with all the values associated with key.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Keys Property

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Keys Property

Gets a read-only collection all the keys in this dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TKey> Keys { get; }
Public Overridable ReadOnly Property Keys As ICollection(Of TKey)
    Get
public:
virtual property ICollection<TKey>^ Keys {
    ICollection<TKey>^ get ();
}

Field Value

An readonly ICollection<TKey> of all the keys in this dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


KeyValuePairs Property

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..KeyValuePairs Property

Gets a read-only collection of all key-value pairs in the dictionary. If a key has multiple values associated with it, then a key-value pair is present for each value associated with the key.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<KeyValuePair<TKey, TValue>> KeyValuePairs { get; }
Public Overridable ReadOnly Property KeyValuePairs As ICollection(Of KeyValuePair(Of TKey, TValue))
    Get
public:
virtual property ICollection<KeyValuePair<TKey, TValue>^>^ KeyValuePairs {
    ICollection<KeyValuePair<TKey, TValue>^>^ get ();
}

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Values Property

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)>..::..Values Property

Gets a read-only collection of all the values in the dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public virtual ICollection<TValue> Values { get; }
Public Overridable ReadOnly Property Values As ICollection(Of TValue)
    Get
public:
virtual property ICollection<TValue>^ Values {
    ICollection<TValue>^ get ();
}

Return Value

A read-only ICollection<TValue> of all the values in the dictionary.

See Also

ReadOnlyMultiDictionaryBase<(Of <(<'TKey, TValue>)>)> Class


Set(T) Class

Set<(Of <(<'T>)>)> Class

Set<T> is a collection that contains items of type T. The item are maintained in a haphazard, unpredictable order, and duplicate items are not allowed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public class Set<T> : CollectionBase<T>

<SerializableAttribute> _
Public Class Set(Of T) _
    Inherits CollectionBase(Of T)
[SerializableAttribute]
generic<typename T>
public ref class Set : public CollectionBase<T>

Type Parameters

T

Remarks

The items are compared in one of two ways. If T implements IComparable<T> then the Equals method of that interface will be used to compare items, otherwise the Equals method from Object will be used. Alternatively, an instance of IComparer<T> can be passed to the constructor to use to compare items.

Set is implemented as a hash table. Inserting, deleting, and looking up an an element all are done in approximately constant time, regardless of the number of items in the Set.

OrderedSet<(Of <(<'T>)>)> is similar, but uses comparison instead of hashing, and does maintains the items in sorted order.

Inheritance Hierarchy

Object
Wintellect.PowerCollections..::..CollectionBase <(Of <(<'T>)>)>
Wintellect.PowerCollections..::..Set<(Of <(<'T>)>)>

See Also

Set<(Of <(<'T>)>)> Members
Wintellect.PowerCollections Namespace
Wintellect.PowerCollections..::..OrderedSet<(Of <(<'T>)>)>


Set(T) Members

Set<(Of <(<'T>)>)> Members

The Set<(Of <(<'T>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | Set<(Of <(<'T>)>)>()()()() | Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.
Public method | Set<(Of <(<'T>)>)>(IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set.
Public method | Set<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.
Public method | Set<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set. The set is initialized with all the items in the given collection.

Methods

Name Description
Public method Add
Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.
Public method AddMany
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.
Public method Clear
Removes all items from the set.
Public method Clone
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method CloneContents
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method Contains
Determines if this set contains an item equal to item. The set is not changed.
Public method Difference
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
Public method DifferenceWith
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.
Public method GetEnumerator
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
Public method Intersection
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
Public method IntersectionWith
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
Public method IsDisjointFrom
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
Public method IsEqualTo
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
Public method IsProperSubsetOf
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.
Public method IsProperSupersetOf
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.
Public method IsSubsetOf
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.
Public method IsSupersetOf
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M), where M is the size of the otherSet.
Public method Remove
Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.
Public method RemoveMany
Removes all the items in collection from the set.
Public method SymmetricDifference
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
Public method SymmetricDifferenceWith
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
Public method TryGetItem

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.
Public method Union
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
Public method UnionWith
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

Properties

 | Name | Description
Public property | Comparer | Returns the IEqualityComparer<T> used to compare items in this set.
Public property | Count | Returns the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


Set(T) Constructor

Set<(Of <(<'T>)>)> Constructor

Overload List

 | Name | Description
Public method | Set<(Of <(<'T>)>)>()()()() | Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.
Public method | Set<(Of <(<'T>)>)>(IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set.
Public method | Set<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>)) | Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.
Public method | Set<(Of <(<'T>)>)>(IEnumerable<(Of <<'(T>)>>), IEqualityComparer<(Of <<'(T>)>>)) | Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set. The set is initialized with all the items in the given collection.

See Also

Set<(Of <(<'T>)>)> Class
Set<(Of <(<'T>)>)> Members


Set(T) Constructor

Set<(Of <(<'T>)>)> Constructor

Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set()
Public Sub New
public:
Set()

Remarks

Items that are null are permitted, and will be sorted before all other items.

See Also

Set<(Of <(<'T>)>)> Class
Set<(Of <(<'T>)>)> Overload


Set(T) Constructor (IEqualityComparer(T))

Set<(Of <(<'T>)>)> Constructor (IEqualityComparer<(Of <(<'T>)>)>)

Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set(
    IEqualityComparer<T> equalityComparer
)
Public Sub New ( _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
Set(
    IEqualityComparer<T>^ equalityComparer
)

Parameters

equalityComparer
Type: IEqualityComparer <(Of <(<' T >)>)>
An instance of IEqualityComparer<T> that will be used to compare items.

See Also

Set<(Of <(<'T>)>)> Class
Set<(Of <(<'T>)>)> Overload


Set(T) Constructor (IEnumerable(T))

Set<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>)

Creates a new Set. The Equals method and GetHashCode method on T will be used to compare items for equality.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set(
    IEnumerable<T> collection
)
Public Sub New ( _
    collection As IEnumerable(Of T) _
)
public:
Set(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the Set.

Remarks

Items that are null are permitted.

See Also

Set<(Of <(<'T>)>)> Class
Set<(Of <(<'T>)>)> Overload


Set(T) Constructor (IEnumerable(T), IEqualityComparer(T))

Set<(Of <(<'T>)>)> Constructor (IEnumerable<(Of <(<'T>)>)>, IEqualityComparer<(Of <(<'T>)>)>)

Creates a new Set. The Equals and GetHashCode method of the passed comparer object will be used to compare items in this set. The set is initialized with all the items in the given collection.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set(
    IEnumerable<T> collection,
    IEqualityComparer<T> equalityComparer
)
Public Sub New ( _
    collection As IEnumerable(Of T), _
    equalityComparer As IEqualityComparer(Of T) _
)
public:
Set(
    IEnumerable<T>^ collection,
    IEqualityComparer<T>^ equalityComparer
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection with items to be placed into the Set.
equalityComparer
Type: IEqualityComparer <(Of <(<' T >)>)>
An instance of IEqualityComparer<T> that will be used to compare items.

See Also

Set<(Of <(<'T>)>)> Class
Set<(Of <(<'T>)>)> Overload


Set(T) Methods

Set<(Of <(<'T>)>)> Methods

The Set<(Of <(<'T>)>)> type exposes the following members.

Methods

Name Description
Public method Add
Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.
Public method AddMany
Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.
Public method Clear
Removes all items from the set.
Public method Clone
Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.
Public method CloneContents
Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.
Public method Contains
Determines if this set contains an item equal to item. The set is not changed.
Public method Difference
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.
Public method DifferenceWith
Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.
Public method GetEnumerator
Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.
Public method Intersection
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.
Public method IntersectionWith
Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.
Public method IsDisjointFrom
Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.
Public method IsEqualTo
Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.
Public method IsProperSubsetOf
Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.
Public method IsProperSupersetOf
Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.
Public method IsSubsetOf
Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.
Public method IsSupersetOf
Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M), where M is the size of the otherSet.
Public method Remove
Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.
Public method RemoveMany
Removes all the items in collection from the set.
Public method SymmetricDifference
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.
Public method SymmetricDifferenceWith
Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.
Public method TryGetItem

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.
Public method Union
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.
Public method UnionWith
Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

See Also

Set<(Of <(<'T>)>)> Class


Add Method

Set<(Of <(<'T>)>)>..::..Add Method

Adds a new item to the set. If the set already contains an item equal to item, that item is replaced with item.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Add(
    T item
)
Public Function Add ( _
    item As T _
) As Boolean
public:
bool^ Add(
    T item
)

Parameters

item
Type: T
The item to add to the set.

Return Value

True if the set already contained an item equal to item (which was replaced), false otherwise.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Adding an item takes approximately constant time, regardless of the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


AddMany Method

Set<(Of <(<'T>)>)>..::..AddMany Method

Adds all the items in collection to the set. If the set already contains an item equal to one of the items in collection, that item will be replaced.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void AddMany(
    IEnumerable<T> collection
)
Public Sub AddMany ( _
    collection As IEnumerable(Of T) _
)
public:
void AddMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to add to the set.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Adding the collection takes time O(M), where M is the number of items in collection.

See Also

Set<(Of <(<'T>)>)> Class


Clear Method

Set<(Of <(<'T>)>)>..::..Clear Method

Removes all items from the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void Clear()
Public Sub Clear
public:
void Clear()

Remarks

Clearing the set takes a constant amount of time, regardless of the number of items in it.

See Also

Set<(Of <(<'T>)>)> Class


Clone Method

Set<(Of <(<'T>)>)>..::..Clone Method

Makes a shallow clone of this set; i.e., if items of the set are reference types, then they are not cloned. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> Clone()
Public Function Clone As Set(Of T)
public:
Set<T>^ Clone()

Return Value

The cloned set.

Remarks

Cloning the set takes time O(N), where N is the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


CloneContents Method

Set<(Of <(<'T>)>)>..::..CloneContents Method

Makes a deep clone of this set. A new set is created with a clone of each element of this set, by calling ICloneable.Clone on each element. If T is a value type, then each element is copied as if by simple assignment.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> CloneContents()
Public Function CloneContents As Set(Of T)
public:
Set<T>^ CloneContents()

Return Value

The cloned set.

Exceptions

Exception | Condition
InvalidOperationException | T is a reference type that does not implement ICloneable.

Remarks

If T is a reference type, it must implement ICloneable. Otherwise, an InvalidOperationException is thrown.

Cloning the set takes time O(N), where N is the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


Contains Method

Set<(Of <(<'T>)>)>..::..Contains Method

Determines if this set contains an item equal to item. The set is not changed.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Contains(
    T item
)
Public Function Contains ( _
    item As T _
) As Boolean
public:
bool^ Contains(
    T item
)

Parameters

item
Type: T
The item to search for.

Return Value

True if the set contains item. False if the set does not contain item.

Remarks

Searching the set for an item takes approximately constant time, regardless of the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


Difference Method

Set<(Of <(<'T>)>)>..::..Difference Method

Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. A new set is created with the difference of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> Difference(
    Set<T> otherSet
)
Public Function Difference ( _
    otherSet As Set(Of T) _
) As Set(Of T)
public:
Set<T>^ Difference(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to difference with.

Return Value

The difference of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The difference of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


DifferenceWith Method

Set<(Of <(<'T>)>)>..::..DifferenceWith Method

Computes the difference of this set with another set. The difference of these two sets is all items that appear in this set, but not in otherSet. This set receives the difference of the two sets; the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void DifferenceWith(
    Set<T> otherSet
)
Public Sub DifferenceWith ( _
    otherSet As Set(Of T) _
)
public:
void DifferenceWith(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to difference with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The difference of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


GetEnumerator Method

Set<(Of <(<'T>)>)>..::..GetEnumerator Method

Returns an enumerator that enumerates all the items in the set. The items are enumerated in sorted order.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEnumerator<T> GetEnumerator()
Public Function GetEnumerator As IEnumerator(Of T)
public:
IEnumerator<T>^ GetEnumerator()

Return Value

An enumerator for enumerating all the items in the Set.

Remarks

Typically, this method is not called directly. Instead the "foreach" statement is used to enumerate the items, which uses this method implicitly.

If an item is added to or deleted from the set while it is being enumerated, then the enumeration will end with an InvalidOperationException.

Enumerating all the items in the set takes time O(N), where N is the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


Intersection Method

Set<(Of <(<'T>)>)>..::..Intersection Method

Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. A new set is created with the intersection of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> Intersection(
    Set<T> otherSet
)
Public Function Intersection ( _
    otherSet As Set(Of T) _
) As Set(Of T)
public:
Set<T>^ Intersection(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to intersection with.

Return Value

The intersection of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


IntersectionWith Method

Set<(Of <(<'T>)>)>..::..IntersectionWith Method

Computes the intersection of this set with another set. The intersection of two sets is all items that appear in both of the sets. This set receives the intersection of the two sets, the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void IntersectionWith(
    Set<T> otherSet
)
Public Sub IntersectionWith ( _
    otherSet As Set(Of T) _
)
public:
void IntersectionWith(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to intersection with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

When equal items appear in both sets, the intersection will include an arbitrary choice of one of the two equal items.

The intersection of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


IsDisjointFrom Method

Set<(Of <(<'T>)>)>..::..IsDisjointFrom Method

Determines if this set is disjoint from another set. Two sets are disjoint if no item from one set is equal to any item in the other set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsDisjointFrom(
    Set<T> otherSet
)
Public Function IsDisjointFrom ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsDisjointFrom(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to check disjointness with.

Return Value

True if the two sets are disjoint, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The answer is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


IsEqualTo Method

Set<(Of <(<'T>)>)>..::..IsEqualTo Method

Determines if this set is equal to another set. This set is equal to otherSet if they contain the same items.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsEqualTo(
    Set<T> otherSet
)
Public Function IsEqualTo ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsEqualTo(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to compare to

Return Value

True if this set is equal to otherSet, false otherwise.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsEqualTo is computed in time O(N), where N is the number of items in this set.

See Also

Set<(Of <(<'T>)>)> Class


IsProperSubsetOf Method

Set<(Of <(<'T>)>)>..::..IsProperSubsetOf Method

Determines if this set is a proper subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet. Additionally, this set must have strictly fewer items than otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSubsetOf(
    Set<T> otherSet
)
Public Function IsProperSubsetOf ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsProperSubsetOf(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a proper subset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsProperSubsetOf is computed in time O(N), where N is the size of the this set.

See Also

Set<(Of <(<'T>)>)> Class


IsProperSupersetOf Method

Set<(Of <(<'T>)>)>..::..IsProperSupersetOf Method

Determines if this set is a proper superset of another set. Neither set is modified. This set is a proper superset of otherSet if every element in otherSet is also in this set. Additionally, this set must have strictly more items than otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsProperSupersetOf(
    Set<T> otherSet
)
Public Function IsProperSupersetOf ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsProperSupersetOf(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a proper superset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsProperSubsetOf is computed in time O(M), where M is the size of otherSet.

See Also

Set<(Of <(<'T>)>)> Class


IsSubsetOf Method

Set<(Of <(<'T>)>)>..::..IsSubsetOf Method

Determines if this set is a subset of another set. Neither set is modified. This set is a subset of otherSet if every element in this set is also in otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSubsetOf(
    Set<T> otherSet
)
Public Function IsSubsetOf ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsSubsetOf(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a subset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

IsSubsetOf is computed in time O(N), where N is the size of the this set.

See Also

Set<(Of <(<'T>)>)> Class


IsSupersetOf Method

Set<(Of <(<'T>)>)>..::..IsSupersetOf Method

Determines if this set is a superset of another set. Neither set is modified. This set is a superset of otherSet if every element in otherSet is also in this set.

Remarks

IsSupersetOf is computed in time O(M), where M is the size of the otherSet.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool IsSupersetOf(
    Set<T> otherSet
)
Public Function IsSupersetOf ( _
    otherSet As Set(Of T) _
) As Boolean
public:
bool^ IsSupersetOf(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to compare to.

Return Value

True if this is a superset of otherSet.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

See Also

Set<(Of <(<'T>)>)> Class


Remove Method

Set<(Of <(<'T>)>)>..::..Remove Method

Searches the set for an item equal to item, and if found, removes it from the set. If not found, the set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Remove(
    T item
)
Public Function Remove ( _
    item As T _
) As Boolean
public:
bool^ Remove(
    T item
)

Parameters

item
Type: T
The item to remove.

Return Value

True if item was found and removed. False if item was not in the set.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Removing an item from the set takes approximately constant time, regardless of the size of the set.

See Also

Set<(Of <(<'T>)>)> Class


RemoveMany Method

Set<(Of <(<'T>)>)>..::..RemoveMany Method

Removes all the items in collection from the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int RemoveMany(
    IEnumerable<T> collection
)
Public Function RemoveMany ( _
    collection As IEnumerable(Of T) _
) As Integer
public:
int^ RemoveMany(
    IEnumerable<T>^ collection
)

Parameters

collection
Type: IEnumerable <(Of <(<' T >)>)>
A collection of items to remove from the set.

Return Value

The number of items removed from the set.

Exceptions

Exception | Condition
ArgumentNullException | collection is null.

Remarks

Equality between items is determined by the comparison instance or delegate used to create the set.

Removing the collection takes time O(M), where M is the number of items in collection.

See Also

Set<(Of <(<'T>)>)> Class


SymmetricDifference Method

Set<(Of <(<'T>)>)>..::..SymmetricDifference Method

Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. A new set is created with the symmetric difference of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> SymmetricDifference(
    Set<T> otherSet
)
Public Function SymmetricDifference ( _
    otherSet As Set(Of T) _
) As Set(Of T)
public:
Set<T>^ SymmetricDifference(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to symmetric difference with.

Return Value

The symmetric difference of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The symmetric difference of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


SymmetricDifferenceWith Method

Set<(Of <(<'T>)>)>..::..SymmetricDifferenceWith Method

Computes the symmetric difference of this set with another set. The symmetric difference of two sets is all items that appear in either of the sets, but not both. This set receives the symmetric difference of the two sets; the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void SymmetricDifferenceWith(
    Set<T> otherSet
)
Public Sub SymmetricDifferenceWith ( _
    otherSet As Set(Of T) _
)
public:
void SymmetricDifferenceWith(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to symmetric difference with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

The symmetric difference of two sets is computed in time O(N), where N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


TryGetItem Method

Set<(Of <(<'T>)>)>..::..TryGetItem Method

Determines if this set contains an item equal to item, according to the comparison mechanism that was used when the set was created. The set is not changed.

If the set does contain an item equal to item, then the item from the set is returned.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool TryGetItem(
    T item,
    out T foundItem
)
Public Function TryGetItem ( _
    item As T, _
    <OutAttribute> ByRef foundItem As T _
) As Boolean
public:
bool^ TryGetItem(
    T item,
    [OutAttribute] T% foundItem
)

Parameters

item
Type: T
The item to search for.
foundItem
Type: T %
Returns the item from the set that was equal to item.

Return Value

True if the set contains item. False if the set does not contain item.

Remarks

Searching the set for an item takes approximately constant time, regardless of the number of items in the set.

Examples

In the following example, the set contains strings which are compared in a case-insensitive manner.
C#
Set<string> set = new Set<string>(StringComparer.CurrentCultureIgnoreCase);
set.Add("HELLO");
string s;
bool b = set.TryGetItem("Hello", out s);   // b receives true, s receives "HELLO".

See Also

Set<(Of <(<'T>)>)> Class


Union Method

Set<(Of <(<'T>)>)>..::..Union Method

Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. A new set is created with the union of the sets and is returned. This set and the other set are unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Set<T> Union(
    Set<T> otherSet
)
Public Function Union ( _
    otherSet As Set(Of T) _
) As Set(Of T)
public:
Set<T>^ Union(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to union with.

Return Value

The union of the two sets.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.

The union of two sets is computed in time O(M + N), where M is the size of the one set, and N is the size of the other set.

See Also

Set<(Of <(<'T>)>)> Class


UnionWith Method

Set<(Of <(<'T>)>)>..::..UnionWith Method

Computes the union of this set with another set. The union of two sets is all items that appear in either or both of the sets. This set receives the union of the two sets, the other set is unchanged.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public void UnionWith(
    Set<T> otherSet
)
Public Sub UnionWith ( _
    otherSet As Set(Of T) _
)
public:
void UnionWith(
    Set<T>^ otherSet
)

Parameters

otherSet
Type: Wintellect.PowerCollections..::..Set <(Of <(<' T >)>)>
Set to union with.

Exceptions

Exception | Condition
InvalidOperationException | This set and otherSet don't use the same method for comparing items.

Remarks

If equal items appear in both sets, the union will include an arbitrary choice of one of the two equal items.

The union of two sets is computed in time O(M + N), where M is the size of the larger set, and N is the size of the smaller set.

See Also

Set<(Of <(<'T>)>)> Class


Set(T) Properties

Set<(Of <(<'T>)>)> Properties

The Set<(Of <(<'T>)>)> type exposes the following members.

Properties

 | Name | Description
Public property | Comparer | Returns the IEqualityComparer<T> used to compare items in this set.
Public property | Count | Returns the number of items in the set.

See Also

Set<(Of <(<'T>)>)> Class


Comparer Property

Set<(Of <(<'T>)>)>..::..Comparer Property

Returns the IEqualityComparer<T> used to compare items in this set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public IEqualityComparer<T> Comparer { get; }
Public ReadOnly Property Comparer As IEqualityComparer(Of T)
    Get
public:
property IEqualityComparer<T>^ Comparer {
    IEqualityComparer<T>^ get ();
}

Field Value

If the set was created using a comparer, that comparer is returned. Otherwise the default comparer for T (EqualityComparer<T>.Default) is returned.

See Also

Set<(Of <(<'T>)>)> Class


Count Property

Set<(Of <(<'T>)>)>..::..Count Property

Returns the number of items in the set.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int Count { get; }
Public ReadOnly Property Count As Integer
    Get
public:
property int^ Count {
    int^ get ();
}

Field Value

The number of items in the set.

Remarks

The size of the set is returned in constant time.

See Also

Set<(Of <(<'T>)>)> Class


Triple(TFirst, TSecond, TThird) Structure

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure

Stores a triple of objects within a single struct. This struct is useful to use as the T of a collection, or as the TKey or TValue of a dictionary.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
[SerializableAttribute]
public struct Triple<TFirst, TSecond, TThird> : IComparable,
    IComparable<Triple<TFirst, TSecond, TThird>>

<SerializableAttribute> _
Public Structure Triple(Of TFirst, TSecond, TThird) _
    Implements IComparable, IComparable(Of Triple(Of TFirst, TSecond, TThird))
[SerializableAttribute]
generic<typename TFirst, typename TSecond, typename TThird>
public value class Triple : IComparable,
    IComparable<Triple<TFirst, TSecond, TThird>^>

Type Parameters

TFirst
TSecond
TThird

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Members


Triple(TFirst, TSecond, TThird) Members

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Members

The Triple<(Of <(<'TFirst, TSecond, TThird>)>)> type exposes the following members.

Constructors

 | Name | Description
Public method | Triple<(Of <(<'TFirst, TSecond, TThird>)>)> | Creates a new triple with given elements.

Methods

 | Name | Description
Public method | CompareTo | Compares this triple to another triple of the some type. The triples are compared by using the IComparable<T> or IComparable interface on TFirst, TSecond, and TThird. The triples are compared by their first elements first, if their first elements are equal, then they are compared by their second elements. If their second elements are also equal, then they are compared by their third elements. If TFirst, TSecond, or TThird does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the triples cannot be compared.
Public method | Equals(Object) | Determines if this triple is equal to another object. The triple is equal to another object if that object is a Triple, all element types are the same, and the all three elements compare equal using object.Equals.
Public method | Equals(Triple<(Of <<'(TFirst, TSecond, TThird>)>>)) | Determines if this triple is equal to another triple. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.
Public method | GetHashCode | Returns a hash code for the triple, suitable for use in a hash-table or other hashed collection. Two triples that compare equal (using Equals) will have the same hash code. The hash code for the triple is derived by combining the hash codes for each of the two elements of the triple.
Public method | ToString | Returns a string representation of the triple. The string representation of the triple is of the form: First: {0}, Second: {1}, Third: {2} where {0} is the result of First.ToString(), {1} is the result of Second.ToString(), and {2} is the result of Third.ToString() (or "null" if they are null.)

Operators

Name | Description
Equality | Determines if two triples are equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.
Inequality | Determines if two triples are not equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

Fields

 | Name | Description
Public field | First | The first element of the triple.
Public field | Second | The second element of the triple.
Public field | Third | The thrid element of the triple.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Triple(TFirst, TSecond, TThird) Constructor

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Constructor

Creates a new triple with given elements.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public Triple(
    TFirst first,
    TSecond second,
    TThird third
)
Public Sub New ( _
    first As TFirst, _
    second As TSecond, _
    third As TThird _
)
public:
Triple(
    TFirst first,
    TSecond second,
    TThird third
)

Parameters

first
Type: TFirst
The first element of the triple.
second
Type: TSecond
The second element of the triple.
third
Type: TThird
The third element of the triple.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Triple(TFirst, TSecond, TThird) Fields

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Fields

The Triple<(Of <(<'TFirst, TSecond, TThird>)>)> type exposes the following members.

Fields

 | Name | Description
Public field | First | The first element of the triple.
Public field | Second | The second element of the triple.
Public field | Third | The thrid element of the triple.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


First Field

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..First Field

The first element of the triple.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TFirst First
Public First As TFirst
public:
TFirst First

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Second Field

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Second Field

The second element of the triple.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TSecond Second
Public Second As TSecond
public:
TSecond Second

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Third Field

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Third Field

The thrid element of the triple.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public TThird Third
Public Third As TThird
public:
TThird Third

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Triple(TFirst, TSecond, TThird) Methods

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Methods

The Triple<(Of <(<'TFirst, TSecond, TThird>)>)> type exposes the following members.

Methods

 | Name | Description
Public method | CompareTo | Compares this triple to another triple of the some type. The triples are compared by using the IComparable<T> or IComparable interface on TFirst, TSecond, and TThird. The triples are compared by their first elements first, if their first elements are equal, then they are compared by their second elements. If their second elements are also equal, then they are compared by their third elements. If TFirst, TSecond, or TThird does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the triples cannot be compared.
Public method | Equals(Object) | Determines if this triple is equal to another object. The triple is equal to another object if that object is a Triple, all element types are the same, and the all three elements compare equal using object.Equals.
Public method | Equals(Triple<(Of <<'(TFirst, TSecond, TThird>)>>)) | Determines if this triple is equal to another triple. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.
Public method | GetHashCode | Returns a hash code for the triple, suitable for use in a hash-table or other hashed collection. Two triples that compare equal (using Equals) will have the same hash code. The hash code for the triple is derived by combining the hash codes for each of the two elements of the triple.
Public method | ToString | Returns a string representation of the triple. The string representation of the triple is of the form: First: {0}, Second: {1}, Third: {2} where {0} is the result of First.ToString(), {1} is the result of Second.ToString(), and {2} is the result of Third.ToString() (or "null" if they are null.)

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


CompareTo Method

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..CompareTo Method

Compares this triple to another triple of the some type. The triples are compared by using the IComparable<T> or IComparable interface on TFirst, TSecond, and TThird. The triples are compared by their first elements first, if their first elements are equal, then they are compared by their second elements. If their second elements are also equal, then they are compared by their third elements.

If TFirst, TSecond, or TThird does not implement IComparable<T> or IComparable, then an NotSupportedException is thrown, because the triples cannot be compared.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int CompareTo(
    Triple<TFirst, TSecond, TThird> other
)
Public Function CompareTo ( _
    other As Triple(Of TFirst, TSecond, TThird) _
) As Integer
public:
int^ CompareTo(
    Triple<TFirst, TSecond, TThird>^ other
)

Parameters

other
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
The triple to compare to.

Return Value

An integer indicating how this triple compares to other. Less than zero indicates this triple is less than other. Zero indicate this triple is equals to other. Greater than zero indicates this triple is greater than other.

Exceptions

Exception | Condition
NotSupportedException | Either FirstSecond, TSecond, or TThird is not comparable via the IComparable<T> or IComparable interfaces.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Equals Method

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Equals Method

Overload List

 | Name | Description
Public method | Equals(Object) | Determines if this triple is equal to another object. The triple is equal to another object if that object is a Triple, all element types are the same, and the all three elements compare equal using object.Equals.
Public method | Equals(Triple<(Of <<'(TFirst, TSecond, TThird>)>>)) | Determines if this triple is equal to another triple. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure
Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Members


Equals Method (Object)

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Equals Method (Object)

Determines if this triple is equal to another object. The triple is equal to another object if that object is a Triple, all element types are the same, and the all three elements compare equal using object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Equals(
    Object obj
)
Public Function Equals ( _
    obj As Object _
) As Boolean
public:
bool^ Equals(
    Object^ obj
)

Parameters

obj
Type: Object
Object to compare for equality.

Return Value

True if the objects are equal. False if the objects are not equal.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure
Equals Overload


Equals Method (Triple(TFirst, TSecond, TThird))

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Equals Method (Triple<(Of <(<'TFirst, TSecond, TThird>)>)>)

Determines if this triple is equal to another triple. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public bool Equals(
    Triple<TFirst, TSecond, TThird> other
)
Public Function Equals ( _
    other As Triple(Of TFirst, TSecond, TThird) _
) As Boolean
public:
bool^ Equals(
    Triple<TFirst, TSecond, TThird>^ other
)

Parameters

other
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
Triple to compare with for equality.

Return Value

True if the triples are equal. False if the triples are not equal.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure
Equals Overload


GetHashCode Method

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..GetHashCode Method

Returns a hash code for the triple, suitable for use in a hash-table or other hashed collection. Two triples that compare equal (using Equals) will have the same hash code. The hash code for the triple is derived by combining the hash codes for each of the two elements of the triple.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public int GetHashCode()
Public Function GetHashCode As Integer
public:
int^ GetHashCode()

Return Value

The hash code.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


ToString Method

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..ToString Method

Returns a string representation of the triple. The string representation of the triple is of the form: First: {0}, Second: {1}, Third: {2} where {0} is the result of First.ToString(), {1} is the result of Second.ToString(), and {2} is the result of Third.ToString() (or "null" if they are null.)

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public string ToString()
Public Function ToString As String
public:
String^ ToString()

Return Value

The string representation of the triple.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Triple(TFirst, TSecond, TThird) Operators

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Operators

The Triple<(Of <(<'TFirst, TSecond, TThird>)>)> type exposes the following members.

Operators

Name | Description
Equality | Determines if two triples are equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.
Inequality | Determines if two triples are not equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Equality Operator

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Equality Operator

Determines if two triples are equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool operator ==(
    Triple<TFirst, TSecond, TThird> pair1,
    Triple<TFirst, TSecond, TThird> pair2
)
Public Shared Operator = ( _
    pair1 As Triple(Of TFirst, TSecond, TThird), _
    pair2 As Triple(Of TFirst, TSecond, TThird) _
) As Boolean
public:
static bool^ operator ==(
    Triple<TFirst, TSecond, TThird>^ pair1,
    Triple<TFirst, TSecond, TThird>^ pair2
)

Parameters

pair1
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
First triple to compare.
pair2
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
Second triple to compare.

Return Value

True if the triples are equal. False if the triples are not equal.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure


Inequality Operator

Triple<(Of <(<'TFirst, TSecond, TThird>)>)>..::..Inequality Operator

Determines if two triples are not equal. Two triples are equal if the all three elements compare equal using IComparable<T>.Equals or object.Equals.

Namespace: Wintellect.PowerCollections
Assembly: PowerCollections (in PowerCollections.dll)

Syntax

C#
VB
C++
public static bool operator !=(
    Triple<TFirst, TSecond, TThird> pair1,
    Triple<TFirst, TSecond, TThird> pair2
)
Public Shared Operator <> ( _
    pair1 As Triple(Of TFirst, TSecond, TThird), _
    pair2 As Triple(Of TFirst, TSecond, TThird) _
) As Boolean
public:
static bool^ operator !=(
    Triple<TFirst, TSecond, TThird>^ pair1,
    Triple<TFirst, TSecond, TThird>^ pair2
)

Parameters

pair1
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
First triple to compare.
pair2
Type: Wintellect.PowerCollections..::..Triple <(Of <(<' TFirst, TSecond, TThird >)>)>
Second triple to compare.

Return Value

True if the triples are not equal. False if the triples are equal.

See Also

Triple<(Of <(<'TFirst, TSecond, TThird>)>)> Structure