Click or drag to resize
AlgorithmsEqualCollectionsT Method (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".

Namespace: X3Platform.Collections
Assembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntax
public static bool EqualCollections<T>(
	IEnumerable<T> collection1,
	IEnumerable<T> collection2,
	BinaryPredicate<T> predicate
)

Parameters

collection1
Type: System.Collections.GenericIEnumerableT
The first collection to compare.
collection2
Type: System.Collections.GenericIEnumerableT
The second collection to compare.
predicate
Type: X3Platform.CollectionsBinaryPredicateT
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.

Type Parameters

T
The type of items in the collections.

Return Value

Type: Boolean
True if predicatereturns true for each corresponding pair of items in the two collections. If both collections are empty, true is returned.
Exceptions
ExceptionCondition
ArgumentNullExceptioncollection1, 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.
List<int> list1, list2;
if (EqualCollections(list1, list2, delegate(int x, int y) { return x <= y; }) {
    // the check is true...
}
See Also