MimeKit.Cryptography.X509CertificateStore.AddRange C# (CSharp) Method

AddRange() public method

Adds the specified range of certificates to the store.
Adds the specified range of certificates to the store.
/// is null. ///
public AddRange ( IEnumerable certificates ) : void
certificates IEnumerable The certificates.
return void
		public void AddRange (IEnumerable<X509Certificate> certificates)
		{
			if (certificates == null)
				throw new ArgumentNullException ("certificates");

			foreach (var certificate in certificates) {
				if (unique.Add (certificate))
					certs.Add (certificate);
			}
		}

Usage Example

		public void TestArgumentExceptions ()
		{
			var store = new X509CertificateStore ();

			Assert.Throws<ArgumentNullException> (() => store.Add (null));
			Assert.Throws<ArgumentNullException> (() => store.AddRange (null));
			Assert.Throws<ArgumentNullException> (() => store.Export ((Stream) null, "password"));
			Assert.Throws<ArgumentNullException> (() => store.Export ((string) null, "password"));
			Assert.Throws<ArgumentNullException> (() => store.Export (Stream.Null, null));
			Assert.Throws<ArgumentNullException> (() => store.Export ("fileName", null));
			Assert.Throws<ArgumentNullException> (() => store.Export ((Stream) null));
			Assert.Throws<ArgumentNullException> (() => store.Export ((string) null));
			Assert.Throws<ArgumentNullException> (() => store.GetPrivateKey (null));
			Assert.Throws<ArgumentNullException> (() => store.Import ((Stream) null, "password"));
			Assert.Throws<ArgumentNullException> (() => store.Import ((string) null, "password"));
			Assert.Throws<ArgumentNullException> (() => store.Import ((byte[]) null, "password"));
			Assert.Throws<ArgumentNullException> (() => store.Import (Stream.Null, null));
			Assert.Throws<ArgumentNullException> (() => store.Import (GetTestDataPath ("smime.p12"), null));
			Assert.Throws<ArgumentNullException> (() => store.Import (new byte[0], null));
			Assert.Throws<ArgumentNullException> (() => store.Import ((Stream) null));
			Assert.Throws<ArgumentNullException> (() => store.Import ((string) null));
			Assert.Throws<ArgumentNullException> (() => store.Import ((byte[]) null));
			Assert.Throws<ArgumentNullException> (() => store.Remove (null));
			Assert.Throws<ArgumentNullException> (() => store.RemoveRange (null));
		}