Partilhar via


CollectionAssert.Contains Method

Definition

Overloads

Contains(ICollection, Object)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

Contains(ICollection, Object, String)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

Contains(ICollection, Object, String, Object[])

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

Contains(ICollection, Object)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

public:
 static void Contains(System::Collections::ICollection ^ collection, System::Object ^ element);
public static void Contains (System.Collections.ICollection collection, object element);
static member Contains : System.Collections.ICollection * obj -> unit
Public Shared Sub Contains (collection As ICollection, element As Object)

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected to be in the collection.

Exceptions

Thrown if element is not found in collection.

Applies to

Contains(ICollection, Object, String)

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

public:
 static void Contains(System::Collections::ICollection ^ collection, System::Object ^ element, System::String ^ message);
public static void Contains (System.Collections.ICollection collection, object element, string message);
static member Contains : System.Collections.ICollection * obj * string -> unit
Public Shared Sub Contains (collection As ICollection, element As Object, message As String)

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected to be in the collection.

message
String

The message to include in the exception when element is not in collection. The message is shown in test results.

Exceptions

Thrown if element is not found in collection.

Applies to

Contains(ICollection, Object, String, Object[])

Tests whether the specified collection contains the specified element and throws an exception if the element is not in the collection.

public:
 static void Contains(System::Collections::ICollection ^ collection, System::Object ^ element, System::String ^ message, ... cli::array <System::Object ^> ^ parameters);
public static void Contains (System.Collections.ICollection collection, object element, string message, params object[] parameters);
static member Contains : System.Collections.ICollection * obj * string * obj[] -> unit
Public Shared Sub Contains (collection As ICollection, element As Object, message As String, ParamArray parameters As Object())

Parameters

collection
ICollection

The collection in which to search for the element.

element
Object

The element that is expected to be in the collection.

message
String

The message to include in the exception when element is not in collection. The message is shown in test results.

parameters
Object[]

An array of parameters to use when formatting message.

Exceptions

Thrown if element is not found in collection.

Applies to