System.Security.Cryptography.X509Certificates.X509Certificate.Equals C# (CSharp) Method

Equals() public method

public Equals ( X509Certificate other ) : bool
other X509Certificate
return bool
        public virtual bool Equals(X509Certificate other)
        {
            if (other == null)
                return false;

            if (Pal == null)
                return other.Pal == null;

            if (!Issuer.Equals(other.Issuer))
                return false;

            byte[] thisSerialNumber = GetRawSerialNumber();
            byte[] otherSerialNumber = other.GetRawSerialNumber();

            if (thisSerialNumber.Length != otherSerialNumber.Length)
                return false;
            for (int i = 0; i < thisSerialNumber.Length; i++)
            {
                if (thisSerialNumber[i] != otherSerialNumber[i])
                    return false;
            }

            return true;
        }

Same methods

X509Certificate::Equals ( System other ) : bool
X509Certificate::Equals ( object obj ) : bool

Usage Example

		public void Equals ()
		{
			X509Certificate x1 = new X509Certificate (cert1);
			Assert.IsTrue (x1.Equals (x1), "Equals-Self-X");
			Assert.IsTrue (x1.Equals ((object)x1), "Equals-Self-O");
			X509Certificate x2 = new X509Certificate (cert1);
			Assert.IsTrue (x1.Equals (x2), "Equals-12-X");
			Assert.IsTrue (x1.Equals ((object)x2), "Equals-12-O");
			Assert.IsTrue (x2.Equals (x1), "Equals-12-X");
			Assert.IsTrue (x2.Equals ((object)x1), "Equals-12-O");
		}
All Usage Examples Of System.Security.Cryptography.X509Certificates.X509Certificate::Equals