AlgorithmsRemoveDuplicatesT Method (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".
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static IEnumerable<T> RemoveDuplicates<T>(
IEnumerable<T> collection,
BinaryPredicate<T> predicate
)
public:
generic<typename T>
static IEnumerable<T>^ RemoveDuplicates(
IEnumerable<T>^ collection,
BinaryPredicate<T>^ predicate
)
Parameters
- collection
- Type: System.Collections.GenericIEnumerableT
The collection to process. - predicate
- Type: X3Platform.CollectionsBinaryPredicateT
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.
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.RemoveDuplicates``1(System.Collections.Generic.IEnumerable{``0},X3Platform.Collections.BinaryPredicate{``0})"]
Return Value
Type:
IEnumerableTAn new collection with the items from
collection, in the same order,
with consecutive "duplicates" removed.
RemarksSince an arbitrary BinaryPredicate is passed to this function, what is being removed need not be true equality.
See Also