AlgorithmsSetIntersectionT Method (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.
Namespace: X3Platform.CollectionsAssembly: X3Platform.Support (in X3Platform.Support.dll) Version: 1.0.0.0 (2.0.0.0)
Syntaxpublic static IEnumerable<T> SetIntersection<T>(
IEnumerable<T> collection1,
IEnumerable<T> collection2,
IEqualityComparer<T> equalityComparer
)
public:
generic<typename T>
static IEnumerable<T>^ SetIntersection(
IEnumerable<T>^ collection1,
IEnumerable<T>^ collection2,
IEqualityComparer<T>^ equalityComparer
)
Parameters
- collection1
- Type: System.Collections.GenericIEnumerableT
The first collection to intersect. - collection2
- Type: System.Collections.GenericIEnumerableT
The second collection to intersect. - equalityComparer
- Type: System.Collections.GenericIEqualityComparerT
The IEqualityComparer<T> used to compare items for equality.
Only the Equals and GetHashCode member functions of this interface are called.
Type Parameters
- T
[Missing <typeparam name="T"/> documentation for "M:X3Platform.Collections.Algorithms.SetIntersection``1(System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEnumerable{``0},System.Collections.Generic.IEqualityComparer{``0})"]
Return Value
Type:
IEnumerableTThe intersection of the two collections, considered as sets.
Exceptions
RemarksWhen 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