public SecStatusCode SetAnchorCertificates(X509Certificate2Collection certificates) { if (handle == IntPtr.Zero) { throw new ObjectDisposedException("SecTrust"); } if (certificates == null) { return(SecTrustSetAnchorCertificates(handle, IntPtr.Zero)); } SecCertificate[] array = new SecCertificate [certificates.Count]; int i = 0; foreach (var certificate in certificates) { array [i++] = new SecCertificate(certificate); } return(SetAnchorCertificates(array)); }