Table of Contents

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

collection IEnumerable<T>

The collection to be inspected

Type Parameters

T

The 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

collection IEnumerable<T>

The collection to be inspected

comparer IEqualityComparer<T>

The comparer used to equate objects in the collection with the expected object

Type Parameters

T

The type of the object to be compared

Exceptions

Thrown when an object is present inside the collection more than once