Assert.AreAllDistinct Method
Definition
Important
Some information relates to prerelease product that may be substantially modified before it’s released. Microsoft makes no warranties, express or implied, with respect to the information provided here.
Overloads
| Name | Description |
|---|---|
| AreAllDistinct(IEnumerable, String, String) |
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal. |
| AreAllDistinct(IEnumerable, IEqualityComparer, String, String) |
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied |
| AreAllDistinct<T>(Span<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified span are distinct (no two elements are equal) using the supplied |
| AreAllDistinct<T>(ReadOnlyMemory<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified memory are distinct (no two elements are equal) using the supplied |
| AreAllDistinct<T>(Memory<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified memory are distinct (no two elements are equal) using the supplied |
| AreAllDistinct<T>(IEnumerable<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied |
| AreAllDistinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>, String, String) |
Tests whether all items in the specified span are distinct (no two elements are equal) using the supplied |
| AreAllDistinct<T>(ReadOnlySpan<T>, String, String) |
Tests whether all items in the specified span are distinct (no two elements are equal). |
| AreAllDistinct<T>(ReadOnlyMemory<T>, String, String) |
Tests whether all items in the specified memory are distinct (no two elements are equal). |
| AreAllDistinct<T>(Memory<T>, String, String) |
Tests whether all items in the specified memory are distinct (no two elements are equal). |
| AreAllDistinct<T>(IEnumerable<T>, String, String) |
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal. |
| AreAllDistinct<T>(Span<T>, String, String) |
Tests whether all items in the specified span are distinct (no two elements are equal). |
AreAllDistinct(IEnumerable, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal.
public static void AreAllDistinct(System.Collections.IEnumerable? collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : System.Collections.IEnumerable * string * string -> unit
Public Shared Sub AreAllDistinct (collection As IEnumerable, Optional message As String = "", Optional collectionExpression As String = "")
Parameters
- collection
- IEnumerable
The collection in which to search for duplicate elements.
- message
- String
The message to include in the exception when collection contains
at least one duplicate element. The message is shown in test results.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct(IEnumerable, IEqualityComparer, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied comparer and throws
an exception if any two elements in the collection are equal.
public static void AreAllDistinct(System.Collections.IEnumerable? collection, System.Collections.IEqualityComparer? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : System.Collections.IEnumerable * System.Collections.IEqualityComparer * string * string -> unit
Public Shared Sub AreAllDistinct (collection As IEnumerable, comparer As IEqualityComparer, Optional message As String = "", Optional collectionExpression As String = "")
Parameters
- collection
- IEnumerable
The collection in which to search for duplicate elements.
- comparer
- IEqualityComparer
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when collection contains
at least one duplicate element. The message is shown in test results.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct<T>(Span<T>, IEqualityComparer<T>, String, String)
Tests whether all items in the specified span are distinct (no two elements are equal) using the supplied comparer.
public static void AreAllDistinct<T>(Span<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : Span<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As Span(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the span items.
Parameters
- collection
- Span<T>
The span in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(ReadOnlyMemory<T>, IEqualityComparer<T>, String, String)
Tests whether all items in the specified memory are distinct (no two elements are equal) using the supplied comparer.
public static void AreAllDistinct<T>(ReadOnlyMemory<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : ReadOnlyMemory<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As ReadOnlyMemory(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the memory items.
Parameters
- collection
- ReadOnlyMemory<T>
The memory in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(Memory<T>, IEqualityComparer<T>, String, String)
Tests whether all items in the specified memory are distinct (no two elements are equal) using the supplied comparer.
public static void AreAllDistinct<T>(Memory<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : Memory<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As Memory(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the memory items.
Parameters
- collection
- Memory<T>
The memory in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(IEnumerable<T>, IEqualityComparer<T>, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two
elements are equal) using the supplied comparer and throws
an exception if any two elements in the collection are equal.
public static void AreAllDistinct<T>(System.Collections.Generic.IEnumerable<T>? collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : seq<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As IEnumerable(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the collection items.
Parameters
- collection
- IEnumerable<T>
The collection in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when collection contains
at least one duplicate element. The message is shown in test results.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct<T>(ReadOnlySpan<T>, IEqualityComparer<T>, String, String)
Tests whether all items in the specified span are distinct (no two elements are equal) using the supplied comparer.
public static void AreAllDistinct<T>(ReadOnlySpan<T> collection, System.Collections.Generic.IEqualityComparer<T>? comparer, string? message = "", string collectionExpression = "");
static member AreAllDistinct : ReadOnlySpan<'T> * System.Collections.Generic.IEqualityComparer<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As ReadOnlySpan(Of T), comparer As IEqualityComparer(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the span items.
Parameters
- collection
- ReadOnlySpan<T>
The span in which to search for duplicate elements.
- comparer
- IEqualityComparer<T>
The equality comparer to use when comparing elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(ReadOnlySpan<T>, String, String)
Tests whether all items in the specified span are distinct (no two elements are equal).
public static void AreAllDistinct<T>(ReadOnlySpan<T> collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : ReadOnlySpan<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As ReadOnlySpan(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the span items.
Parameters
- collection
- ReadOnlySpan<T>
The span in which to search for duplicate elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(ReadOnlyMemory<T>, String, String)
Tests whether all items in the specified memory are distinct (no two elements are equal).
public static void AreAllDistinct<T>(ReadOnlyMemory<T> collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : ReadOnlyMemory<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As ReadOnlyMemory(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the memory items.
Parameters
- collection
- ReadOnlyMemory<T>
The memory in which to search for duplicate elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(Memory<T>, String, String)
Tests whether all items in the specified memory are distinct (no two elements are equal).
public static void AreAllDistinct<T>(Memory<T> collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : Memory<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As Memory(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the memory items.
Parameters
- collection
- Memory<T>
The memory in which to search for duplicate elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Applies to
AreAllDistinct<T>(IEnumerable<T>, String, String)
- Source:
- Assert.AreAllDistinct.cs
Tests whether all items in the specified collection are distinct (no two elements are equal) and throws an exception if any two elements in the collection are equal.
public static void AreAllDistinct<T>(System.Collections.Generic.IEnumerable<T>? collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : seq<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As IEnumerable(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the collection items.
Parameters
- collection
- IEnumerable<T>
The collection in which to search for duplicate elements.
- message
- String
The message to include in the exception when collection contains
at least one duplicate element. The message is shown in test results.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.
Exceptions
Thrown if collection is null or contains at least one duplicate element.
Applies to
AreAllDistinct<T>(Span<T>, String, String)
Tests whether all items in the specified span are distinct (no two elements are equal).
public static void AreAllDistinct<T>(Span<T> collection, string? message = "", string collectionExpression = "");
static member AreAllDistinct : Span<'T> * string * string -> unit
Public Shared Sub AreAllDistinct(Of T) (collection As Span(Of T), Optional message As String = "", Optional collectionExpression As String = "")
Type Parameters
- T
The type of the span items.
Parameters
- collection
- Span<T>
The span in which to search for duplicate elements.
- message
- String
The message to include in the exception when the assertion fails.
- collectionExpression
- String
The syntactic expression of collection as given by the compiler via caller argument expression. Users shouldn't pass a value for this parameter.