CollectionAssert.Contains 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
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. |
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[])
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
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);
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
collection
is null, or collection
does not contain
element element
.
Applies to
Contains(ICollection, Object)
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
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);
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
collection
is null, or collection
does not contain
element element
.
Applies to
Contains(ICollection, Object, String)
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
- Source:
- CollectionAssert.cs
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);
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
collection
is null, or collection
does not contain
element element
.