Click or drag to resize
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>.
Inheritance Hierarchy
SystemObject
  X3Platform.CollectionsAlgorithms

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static class Algorithms

The Algorithms type exposes the following members.

Methods
  NameDescription
Public methodStatic memberBinarySearchT(IListT, 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>).
Public methodStatic memberBinarySearchT(IListT, T, IComparerT, 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>.
Public methodStatic memberBinarySearchT(IListT, T, ComparisonT, 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.
Public methodStatic memberCartesianProductTFirst, 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.
Public methodStatic memberConcatenateT
Concatenates all the items from several collections. The collections need not be of the same type, but must have the same item type.
Public methodStatic memberConvertTSource, 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.
Public methodStatic memberCopyT(IEnumerableT, IListT, 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.
Public methodStatic memberCopyT(IEnumerableT, T, Int32)
Copies all of the items from the collection source to the array dest, starting at the index destIndex.
Public methodStatic memberCopyT(IEnumerableT, IListT, 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.
Public methodStatic memberCopyT(IEnumerableT, 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.
Public methodStatic memberCopyT(IListT, Int32, IListT, 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.
Public methodStatic memberCopyT(IListT, Int32, 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.
Public methodStatic memberCountT
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.
Public methodStatic memberCountEqualT(IEnumerableT, T)
Counts the number of items in the collection that are equal to find.
Public methodStatic memberCountEqualT(IEnumerableT, T, IEqualityComparerT)
Counts the number of items in the collection that are equal to find.
Public methodStatic memberCountWhereT
Counts the number of items in the collection that satisfy the condition defined by predicate.
Public methodStatic memberDisjointSetsT(IEnumerableT, IEnumerableT)
Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
Public methodStatic memberDisjointSetsT(IEnumerableT, IEnumerableT, IEqualityComparerT)
Determines if two collections are disjoint, considered as sets. Two sets are disjoint if they have no common items.
Public methodStatic memberEqualCollectionsT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberEqualCollectionsT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberEqualCollectionsT(IEnumerableT, IEnumerableT, BinaryPredicateT)
Determines if the two collections contain "equal" items in the same order. The passed BinaryPredicate is used to determine if two items are "equal".
Public methodStatic memberEqualSetsT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberEqualSetsT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberExistsT
Determines if a collection contains any item that satisfies the condition defined by predicate.
Public methodStatic memberFillT(IListT, T)
Replaces each item in a list with a given value. The list does not change in size.
Public methodStatic memberFillT(T, T)
Replaces each item in a array with a given value.
Public methodStatic memberFillRangeT(IListT, Int32, Int32, T)
Replaces each item in a part of a list with a given value.
Public methodStatic memberFillRangeT(T, Int32, Int32, T)
Replaces each item in a part of a array with a given value.
Public methodStatic memberFindFirstIndexWhereT
Finds the index of the first item in a list that satisfies the condition defined by predicate.
Public methodStatic memberFindFirstWhereT
Finds the first item in a collection that satisfies the condition defined by predicate.
Public methodStatic memberFindIndicesWhereT
Enumerates the indices of all the items in list that satisfy the condition defined by predicate.
Public methodStatic memberFindLastIndexWhereT
Finds the index of the last item in a list that satisfies the condition defined by predicate.
Public methodStatic memberFindLastWhereT
Finds the last item in a collection that satisfies the condition defined by predicate.
Public methodStatic memberFindWhereT
Enumerates all the items in collection that satisfy the condition defined by predicate.
Public methodStatic memberFirstConsecutiveEqualT(IListT, Int32)
Finds the first occurence of count consecutive equal items in the list.
Public methodStatic memberFirstConsecutiveEqualT(IListT, Int32, IEqualityComparerT)
Finds the first occurence of count consecutive equal items in the list. A passed IEqualityComparer is used to determine equality.
Public methodStatic memberFirstConsecutiveEqualT(IListT, Int32, BinaryPredicateT)
Finds the first occurence of count consecutive "equal" items in the list. The passed BinaryPredicate is used to determine if two items are "equal".
Public methodStatic memberFirstConsecutiveWhereT
Finds the first occurence of count consecutive items in the list for which a given predicate returns true.
Public methodStatic memberFirstIndexOfT(IListT, T)
Finds the index of the first item in a list equal to a given item.
Public methodStatic memberFirstIndexOfT(IListT, T, IEqualityComparerT)
Finds the index of the first item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
Public methodStatic memberFirstIndexOfManyT(IListT, IEnumerableT)
Finds the index of the first item in a list equal to one of several given items.
Public methodStatic memberFirstIndexOfManyT(IListT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberFirstIndexOfManyT(IListT, IEnumerableT, BinaryPredicateT)
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".
Public methodStatic memberForEachT
Performs the specified action on each item in a collection.
Public methodStatic memberGeneratePermutationsT
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.
Public methodStatic memberGenerateSortedPermutationsT(IEnumerableT)
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.
Public methodStatic memberGenerateSortedPermutationsT(IEnumerableT, IComparerT)
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.
Public methodStatic memberGenerateSortedPermutationsT(IEnumerableT, ComparisonT)
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.
Public methodStatic memberCode exampleGetCollectionEqualityComparerT
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.
Public methodStatic memberCode exampleGetCollectionEqualityComparerT(IEqualityComparerT)

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

Public methodStatic memberGetComparerFromComparisonT
Given a comparison delegate that compares two items of type T, gets an IComparer<T> instance that performs the same comparison.
Public methodStatic memberGetComparisonFromComparerT
Given in IComparer<T> instenace that comparers two items from type T, gets a Comparison delegate that performs the same comparison.
Public methodStatic memberGetDictionaryConverterTKey, TValue(IDictionaryTKey, 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).
Public methodStatic memberGetDictionaryConverterTKey, TValue(IDictionaryTKey, 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.
Public methodStatic memberGetIdentityComparerT
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.
Public methodStatic memberGetLexicographicalComparerT
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.
Public methodStatic memberGetLexicographicalComparerT(IComparerT)
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.
Public methodStatic memberGetLexicographicalComparerT(ComparisonT)
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.
Public methodStatic memberGetReverseComparerT
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.
Public methodStatic memberGetReverseComparisonT
Reverses the order of comparison of an Comparison<T>. The resulting comparison can be used, for example, to sort a collection in descending order.
Public methodStatic memberCode exampleGetSetEqualityComparerT

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

Public methodStatic memberCode exampleGetSetEqualityComparerT(IEqualityComparerT)
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.
Public methodStatic memberIndexOfMaximumT(IListT)
Finds the index of the maximum value in a list.
Public methodStatic memberIndexOfMaximumT(IListT, IComparerT)
Finds the index of the maximum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
Public methodStatic memberIndexOfMaximumT(IListT, ComparisonT)
Finds the index of the maximum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
Public methodStatic memberIndexOfMinimumT(IListT)
Finds the index of the minimum value in a list.
Public methodStatic memberIndexOfMinimumT(IListT, IComparerT)
Finds the index of the minimum value in a list. A supplied IComparer<T> is used to compare the items in the collection.
Public methodStatic memberIndexOfMinimumT(IListT, ComparisonT)
Finds the index of the minimum value in a list. A supplied Comparison<T> delegate is used to compare the items in the collection.
Public methodStatic memberIndicesOfT(IListT, T)
Enumerates the indices of all the items in a list equal to a given item.
Public methodStatic memberIndicesOfT(IListT, T, IEqualityComparerT)
Enumerates the indices of all the items in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
Public methodStatic memberIndicesOfManyT(IListT, IEnumerableT)
Enumerates the indices of all the items in a list equal to one of several given items.
Public methodStatic memberIndicesOfManyT(IListT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberIndicesOfManyT(IListT, IEnumerableT, BinaryPredicateT)
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".
Public methodStatic memberIsProperSubsetOfT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberIsProperSubsetOfT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberIsSubsetOfT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberIsSubsetOfT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberLastIndexOfT(IListT, T)
Finds the index of the last item in a list equal to a given item.
Public methodStatic memberLastIndexOfT(IListT, T, IEqualityComparerT)
Finds the index of the last item in a list equal to a given item. A passed IEqualityComparer is used to determine equality.
Public methodStatic memberLastIndexOfManyT(IListT, IEnumerableT)
Finds the index of the last item in a list equal to one of several given items.
Public methodStatic memberLastIndexOfManyT(IListT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberLastIndexOfManyT(IListT, IEnumerableT, BinaryPredicateT)
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".
Public methodStatic memberLexicographicalCompareT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberLexicographicalCompareT(IEnumerableT, IEnumerableT, IComparerT)
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.
Public methodStatic memberLexicographicalCompareT(IEnumerableT, IEnumerableT, ComparisonT)
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.
Public methodStatic memberMaximumT(IEnumerableT)
Finds the maximum value in a collection.
Public methodStatic memberMaximumT(IEnumerableT, IComparerT)
Finds the maximum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Public methodStatic memberMaximumT(IEnumerableT, ComparisonT)
Finds the maximum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
Public methodStatic memberMergeSortedT(IEnumerableT)
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.
Public methodStatic memberMergeSortedT(IComparerT, IEnumerableT)
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.
Public methodStatic memberMergeSortedT(ComparisonT, IEnumerableT)
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.
Public methodStatic memberMinimumT(IEnumerableT)
Finds the minimum value in a collection.
Public methodStatic memberMinimumT(IEnumerableT, IComparerT)
Finds the minimum value in a collection. A supplied IComparer<T> is used to compare the items in the collection.
Public methodStatic memberMinimumT(IEnumerableT, ComparisonT)
Finds the minimum value in a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
Public methodStatic memberCode exampleNCopiesOfT
Creates an IEnumerator that enumerates a given item n times.
Public methodStatic memberPartitionT
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.
Public methodStatic memberRandomShuffleT(IEnumerableT)
Randomly shuffles the items in a collection, yielding a new collection.
Public methodStatic memberRandomShuffleT(IEnumerableT, Random)
Randomly shuffles the items in a collection, yielding a new collection.
Public methodStatic memberRandomShuffleInPlaceT(IListT)
Randomly shuffles the items in a list or array, in place.
Public methodStatic memberRandomShuffleInPlaceT(IListT, Random)
Randomly shuffles the items in a list or array, in place.
Public methodStatic memberRandomSubsetT(IEnumerableT, 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.
Public methodStatic memberRandomSubsetT(IEnumerableT, 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.
Public methodStatic memberRangeT(IListT, 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.
Public methodStatic memberRangeT(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).
Public methodStatic memberReadOnlyT(ICollectionT)
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.
Public methodStatic memberReadOnlyT(IListT)
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.
Public methodStatic memberReadOnlyTKey, TValue(IDictionaryTKey, 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.
Public methodStatic memberReadWriteListT

Creates a read-write IList<T> wrapper around an array. When an array is implicitely converted to an IList<T>, changes to the items in the array cannot be made through the interface. This method creates a read-write IList<T> wrapper on an array that can be used to make changes to the array.

Use this method when you need to pass an array to an algorithms that takes an IList<T> and that tries to modify items in the list. Algorithms in this class generally do not need this method, since they have been design to operate on arrays even when they are passed as an IList<T>.

Public methodStatic memberRemoveDuplicatesT(IEnumerableT)
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.
Public methodStatic memberRemoveDuplicatesT(IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberRemoveDuplicatesT(IEnumerableT, BinaryPredicateT)
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".
Public methodStatic memberRemoveDuplicatesInPlaceT(IListT)
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.
Public methodStatic memberRemoveDuplicatesInPlaceT(IListT, IEqualityComparerT)
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.
Public methodStatic memberRemoveDuplicatesInPlaceT(IListT, BinaryPredicateT)
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".
Public methodStatic memberRemoveWhereT
Removes all the items in the collection that satisfy the condition defined by predicate.
Public methodStatic memberReplaceT(IEnumerableT, PredicateT, T)
Replace all items in a collection that a predicate evalues at true with a value, yielding another collection. .
Public methodStatic memberReplaceT(IEnumerableT, T, T)
Replace all items in a collection equal to a particular value with another values, yielding another collection.
Public methodStatic memberReplaceT(IEnumerableT, T, T, IEqualityComparerT)
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.
Public methodStatic memberReplaceInPlaceT(IListT, PredicateT, 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.
Public methodStatic memberReplaceInPlaceT(IListT, 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.
Public methodStatic memberReplaceInPlaceT(IListT, T, T, IEqualityComparerT)
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.
Public methodStatic memberReverseT
Reverses a list and returns the reversed list, without changing the source list.
Public methodStatic memberReverseInPlaceT
Reverses a list or array in place.
Public methodStatic memberRotateT
Rotates a list and returns the rotated list, without changing the source list.
Public methodStatic memberRotateInPlaceT
Rotates a list or array in place.
Public methodStatic memberSearchForSubsequenceT(IListT, IEnumerableT)
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.
Public methodStatic memberSearchForSubsequenceT(IListT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberSearchForSubsequenceT(IListT, IEnumerableT, BinaryPredicateT)
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".
Public methodStatic memberSetDifferenceT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberSetDifferenceT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberSetIntersectionT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberSetIntersectionT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberSetSymmetricDifferenceT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberSetSymmetricDifferenceT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberSetUnionT(IEnumerableT, IEnumerableT)
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.
Public methodStatic memberSetUnionT(IEnumerableT, IEnumerableT, IEqualityComparerT)
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.
Public methodStatic memberSortT(IEnumerableT)
Creates a sorted version of a collection.
Public methodStatic memberSortT(IEnumerableT, IComparerT)
Creates a sorted version of a collection. A supplied IComparer<T> is used to compare the items in the collection.
Public methodStatic memberSortT(IEnumerableT, ComparisonT)
Creates a sorted version of a collection. A supplied Comparison<T> delegate is used to compare the items in the collection.
Public methodStatic memberSortInPlaceT(IListT)
Sorts a list or array in place.
Public methodStatic memberSortInPlaceT(IListT, IComparerT)
Sorts a list or array in place. A supplied IComparer<T> is used to compare the items in the list.
Public methodStatic memberSortInPlaceT(IListT, ComparisonT)
Sorts a list or array in place. A supplied Comparison<T> delegate is used to compare the items in the list.
Public methodStatic memberStablePartitionT
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.
Public methodStatic memberStableSortT(IEnumerableT)
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.
Public methodStatic memberStableSortT(IEnumerableT, IComparerT)
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.
Public methodStatic memberStableSortT(IEnumerableT, ComparisonT)
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.
Public methodStatic memberStableSortInPlaceT(IListT)
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.
Public methodStatic memberStableSortInPlaceT(IListT, IComparerT)
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.
Public methodStatic memberStableSortInPlaceT(IListT, ComparisonT)
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.
Public methodStatic memberToArrayT
Create an array with the items in a collection.
Public methodStatic memberToStringT(IEnumerableT)
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.
Public methodStatic memberToStringT(IEnumerableT, 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").
Public methodStatic memberToStringTKey, TValue(IDictionaryTKey, 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.
Public methodStatic memberTrueForAllT
Determines if all of the items in the collection satisfy the condition defined by predicate.
Public methodStatic memberTryFindFirstWhereT
Finds the first item in a collection that satisfies the condition defined by predicate.
Public methodStatic memberTryFindLastWhereT
Finds the last item in a collection that satisfies the condition defined by predicate.
Public methodStatic memberTypedAsT(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.
Public methodStatic memberTypedAsT(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.
Public methodStatic memberTypedAsT(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.
Public methodStatic memberUntypedT(ICollectionT)
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.
Public methodStatic memberUntypedT(IListT)
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.
Top
See Also