X509Certificate.Equals Method (Object)
[ This article is for Windows Phone 8 developers. If you’re developing for Windows 10, see the latest documentation. ]
Compares two X509Certificate objects for equality.
Assembly: mscorlib (in mscorlib.dll)
Parameters
- obj
- Type: System.Object
An object to compare to the current object.
Return Value
Type: System.Booleantrue if the current X509Certificate object is equal to the object specified by the other parameter; otherwise, false.
The following example compares two certificates for equality.
using System; using System.Security.Cryptography.X509Certificates; public class Example { public static void Demo(System.Windows.Controls.TextBlock outputBlock) { // The path to the certificate. string Certificate = "Certificate.cer"; string OtherCertificate = "OtherCertificate.cer"; // Load the certificate into an X509Certificate object. X509Certificate cert = X509Certificate.CreateFromCertFile(Certificate); // Load the certificate into an X509Certificate object. X509Certificate certTwo = X509Certificate.CreateFromCertFile(OtherCertificate); // Get the value. bool result = cert.Equals(certTwo); // Display the value. outputBlock.Text += result + "\n"; } }
Show: