CertificateCollectionRemove Method (Certificate)
Removes the specified Certificate from the collection.

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

Parameters

cert
Type: MailBee.SecurityCertificate
The certificate that should be removed from the collection.

Return Value

Type: Boolean
true if the certificate was removed from the collection; false if the certificate is not contained in the collection.
Exceptions
ExceptionCondition
MailBeeInvalidArgumentExceptioncert is a null reference (Nothing in Visual Basic).
Examples
The sample removes all the certificates without private key from the collection.
// 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)

CertificateStore store = new CertificateStore(@"C:\Temp\certificate.pfx", CertStoreType.PfxFile, "password");
CertificateCollection col = store.GetAllCertificates();

// Remove all certificates which don't have any private key
for (int i = col.Count - 1; i >= 0 ; i--)
{
    if (!col[i].HasPrivateKey)
    {
        col.Remove(col[i]);
    }
}
// Save changes to disk
if (col.Count > 0)
{
    CertificateStore newStore = new CertificateStore();
    newStore.AddCertificates(col, true);
    newStore.SaveToFile(@"C:\Temp\private.sst", CertStoreFileType.Sst, null);
}
See Also