X509Certificate2Collection.Contains(X509Certificate2) 方法

定义

确定 X509Certificate2Collection 对象是否包含特定证书。

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

参数

certificate
X509Certificate2

要在集合中定位的 X509Certificate2 对象。

返回

如果 X509Certificate2Collection 包含指定的 certificate,则为 true;否则为 false

例外

certificatenull

注解

此方法执行线性搜索;因此,平均执行时间与 Count 属性成正比。 也就是说,此方法是 O (n) 操作,其中 nCount

此方法通过调用 Object.Equals 方法确定相等性。

适用于