CertificateCollectionContains Method
Checks whether the specified certificate is contained in the collection or not.

Namespace: MailBee.Security
Assembly: MailBee.NET (in MailBee.NET.dll) Version: 11.2.0 build 590 for .NET 4.5
public bool Contains(
	Certificate cert


Type: MailBee.SecurityCertificate
The certificate that should be checked.

Return Value

Type: Boolean
true if the certificate was found in the collection; otherwise, false.
This sample adds the certificate to the collection if it's not already present there.
// To use the code below, import MailBee namespace at the top of your code
using MailBee.Security;

// The actual code (put it into a method of your class)
Certificate cert = new Certificate(@"C:\Temp\certificate.cer", CertFileType.Cer, null);
CertificateStore store = new CertificateStore(@"C:\Temp\my_store.p7b", CertStoreType.PublicFile, null);
CertificateCollection collection = store.GetAllCertificates();

// Add certificate to the collection if it doesn't contain such certificate
if (!collection.Contains(cert))
    store.AddCertificate(cert, false);
store.SaveToFile(@"C:\Temp\my_store.p7b", CertStoreFileType.P7b, null);
See Also