System.Security.Cryptography.X509Certificates.X509Certificate2Collection.AddRange C# (CSharp) Method

AddRange() public method

public AddRange ( System certificates ) : void
certificates System
return void
        public void AddRange(System.Security.Cryptography.X509Certificates.X509Certificate2[] certificates)
        {
        }

Same methods

X509Certificate2Collection::AddRange ( X509Certificate2 certificates ) : void
X509Certificate2Collection::AddRange ( X509Certificate2Collection certificates ) : void

Usage Example

 private static System.Security.Cryptography.SafeCertStoreHandle BuildDecryptorStore(X509Certificate2Collection extraStore)
 {
     X509Certificate2Collection collection = new X509Certificate2Collection();
     try
     {
         X509Store store = new X509Store("MY", StoreLocation.CurrentUser);
         store.Open(OpenFlags.IncludeArchived | OpenFlags.OpenExistingOnly);
         collection.AddRange(store.Certificates);
     }
     catch (SecurityException)
     {
     }
     try
     {
         X509Store store2 = new X509Store("MY", StoreLocation.LocalMachine);
         store2.Open(OpenFlags.IncludeArchived | OpenFlags.OpenExistingOnly);
         collection.AddRange(store2.Certificates);
     }
     catch (SecurityException)
     {
     }
     if (extraStore != null)
     {
         collection.AddRange(extraStore);
     }
     if (collection.Count == 0)
     {
         throw new CryptographicException(-2146889717);
     }
     return System.Security.Cryptography.X509Certificates.X509Utils.ExportToMemoryStore(collection);
 }
All Usage Examples Of System.Security.Cryptography.X509Certificates.X509Certificate2Collection::AddRange