Method Distinct
- Namespace
- Xunit
- Assembly
- xunit.v3.assert.dll
Distinct<T>(IEnumerable<T>)
Verifies that a collection contains each object only once.
public static void Distinct<T>(IEnumerable<T> collection)
Parameters
collectionIEnumerable<T>The collection to be inspected
Type Parameters
TThe type of the object to be compared
Exceptions
Thrown when an object is present inside the collection more than once
Distinct<T>(IEnumerable<T>, IEqualityComparer<T>)
Verifies that a collection contains each object only once.
public static void Distinct<T>(IEnumerable<T> collection, IEqualityComparer<T> comparer)
Parameters
collectionIEnumerable<T>The collection to be inspected
comparerIEqualityComparer<T>The comparer used to equate objects in the collection with the expected object
Type Parameters
TThe type of the object to be compared
Exceptions
Thrown when an object is present inside the collection more than once