X509Certificate2Collection.Contains(X509Certificate2) Method

Definition

Determines whether the X509Certificate2Collection object contains a specific certificate.

public:
 bool Contains(System::Security::Cryptography::X509Certificates::X509Certificate2 ^ certificate);
public bool Contains (System.Security.Cryptography.X509Certificates.X509Certificate2 certificate);
override this.Contains : System.Security.Cryptography.X509Certificates.X509Certificate2 -> bool
Public Function Contains (certificate As X509Certificate2) As Boolean

Parameters

certificate
X509Certificate2

The X509Certificate2 object to locate in the collection.

Returns

true if the X509Certificate2Collection contains the specified certificate; otherwise, false.

Exceptions

certificate is null.

Remarks

This method performs a linear search; therefore, the average execution time is proportional to the Count property. That is, this method is an O(n) operation, where n is Count.

This method determines equality by calling the Object.Equals method.

Applies to